mirror of
https://github.com/zeek/zeek.git
synced 2025-10-12 19:48:20 +00:00
Use unordered_map to store sessions for performance reasons
This commit is contained in:
parent
2a717e05cc
commit
e2dc6df8a2
4 changed files with 36 additions and 4 deletions
|
@ -218,9 +218,17 @@ void Manager::Insert(Session* s, bool remove_existing)
|
|||
|
||||
void Manager::Drain()
|
||||
{
|
||||
for ( const auto& entry : session_map )
|
||||
std::vector<const detail::Key*> keys;
|
||||
keys.reserve(session_map.size());
|
||||
|
||||
for ( auto& entry : session_map )
|
||||
keys.push_back(&(entry.first));
|
||||
std::sort(keys.begin(), keys.end(), [](const detail::Key* a, const detail::Key* b) {
|
||||
return *a < *b; });
|
||||
|
||||
for ( const auto* k : keys )
|
||||
{
|
||||
Session* tc = entry.second;
|
||||
Session* tc = session_map.at(*k);
|
||||
tc->Done();
|
||||
tc->RemovalEvent();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue