mirror of
https://github.com/zeek/zeek.git
synced 2025-10-12 11:38:20 +00:00
Fix a btest's race condition by handling Pcap::file_done
This commit is contained in:
parent
7c124881cd
commit
5b74bbf99a
1 changed files with 2 additions and 13 deletions
|
@ -3,7 +3,7 @@
|
||||||
#
|
#
|
||||||
# @TEST-EXEC: btest-bg-run manager-1 "cp ../cluster-layout.zeek . && CLUSTER_NODE=manager-1 zeek %INPUT"
|
# @TEST-EXEC: btest-bg-run manager-1 "cp ../cluster-layout.zeek . && CLUSTER_NODE=manager-1 zeek %INPUT"
|
||||||
# @TEST-EXEC: btest-bg-run worker-1 "cp ../cluster-layout.zeek . && CLUSTER_NODE=worker-1 zeek --pseudo-realtime -C -r $TRACES/wikipedia.trace %INPUT"
|
# @TEST-EXEC: btest-bg-run worker-1 "cp ../cluster-layout.zeek . && CLUSTER_NODE=worker-1 zeek --pseudo-realtime -C -r $TRACES/wikipedia.trace %INPUT"
|
||||||
# @TEST-EXEC: btest-bg-wait 20
|
# @TEST-EXEC: btest-bg-wait 30
|
||||||
# @TEST-EXEC: btest-diff manager-1/http.log
|
# @TEST-EXEC: btest-diff manager-1/http.log
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,31 +44,20 @@ event die()
|
||||||
terminate();
|
terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
event slow_death()
|
event Pcap::file_done(path: string)
|
||||||
{
|
{
|
||||||
Broker::flush_logs();
|
Broker::flush_logs();
|
||||||
schedule 2sec { die() };
|
schedule 2sec { die() };
|
||||||
}
|
}
|
||||||
|
|
||||||
event kill_worker()
|
|
||||||
{
|
|
||||||
Broker::publish("death", slow_death);
|
|
||||||
}
|
|
||||||
|
|
||||||
event zeek_init()
|
event zeek_init()
|
||||||
{
|
{
|
||||||
if ( Cluster::node == "worker-1" )
|
if ( Cluster::node == "worker-1" )
|
||||||
{
|
|
||||||
suspend_processing();
|
suspend_processing();
|
||||||
Broker::subscribe("death");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
||||||
{
|
{
|
||||||
if ( Cluster::node == "manager-1" )
|
|
||||||
schedule 2sec { kill_worker() };
|
|
||||||
|
|
||||||
if ( Cluster::node == "worker-1" )
|
if ( Cluster::node == "worker-1" )
|
||||||
continue_processing();
|
continue_processing();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue