mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 22:58:20 +00:00
Only sort sessions during Drain() if a random seed is set
This commit is contained in:
parent
e2dc6df8a2
commit
201617540d
1 changed files with 27 additions and 12 deletions
|
@ -217,6 +217,11 @@ void Manager::Insert(Session* s, bool remove_existing)
|
||||||
}
|
}
|
||||||
|
|
||||||
void Manager::Drain()
|
void Manager::Drain()
|
||||||
|
{
|
||||||
|
// If a random seed was passed in, we're most likely in testing mode and need the
|
||||||
|
// order of the sessions to be consistent. Sort the keys to force that order
|
||||||
|
// every run.
|
||||||
|
if ( zeek::util::detail::have_random_seed() )
|
||||||
{
|
{
|
||||||
std::vector<const detail::Key*> keys;
|
std::vector<const detail::Key*> keys;
|
||||||
keys.reserve(session_map.size());
|
keys.reserve(session_map.size());
|
||||||
|
@ -233,6 +238,16 @@ void Manager::Drain()
|
||||||
tc->RemovalEvent();
|
tc->RemovalEvent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for ( const auto& entry : session_map )
|
||||||
|
{
|
||||||
|
Session* tc = entry.second;
|
||||||
|
tc->Done();
|
||||||
|
tc->RemovalEvent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Manager::Clear()
|
void Manager::Clear()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue