mirror of
https://github.com/zeek/zeek.git
synced 2025-10-13 12:08:20 +00:00
Add type field to session::Key to help avoid collisions in map
This commit is contained in:
parent
30ab914cd8
commit
3a8047f535
4 changed files with 20 additions and 13 deletions
|
@ -4,7 +4,8 @@
|
|||
|
||||
namespace zeek::session::detail {
|
||||
|
||||
Key::Key(const void* session, size_t size, bool copy) : size(size)
|
||||
Key::Key(const void* session, size_t size, size_t type, bool copy) :
|
||||
size(size), type(type)
|
||||
{
|
||||
data = reinterpret_cast<const uint8_t*>(session);
|
||||
|
||||
|
@ -63,6 +64,8 @@ bool Key::operator<(const Key& rhs) const
|
|||
{
|
||||
if ( size != rhs.size )
|
||||
return size < rhs.size;
|
||||
else if ( type != rhs.type )
|
||||
return type < rhs.type;
|
||||
|
||||
return memcmp(data, rhs.data, size) < 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue