mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Fix potential race in openflow broker plugin
Broker::subscribe() after Broker::peer() may result in losing messages, always best to do the reverse order. Also possibly improved chance of unstable unit test output order.
This commit is contained in:
parent
2bb529f5b7
commit
a8c0cd7dee
4 changed files with 10 additions and 5 deletions
|
@ -2,7 +2,7 @@
|
|||
# @TEST-EXEC: btest-bg-run recv "zeek -b ../recv.zeek >recv.out"
|
||||
# @TEST-EXEC: btest-bg-run send "zeek -b -r $TRACES/smtp.trace --pseudo-realtime ../send.zeek >send.out"
|
||||
|
||||
# @TEST-EXEC: btest-bg-wait 20
|
||||
# @TEST-EXEC: btest-bg-wait 30
|
||||
# @TEST-EXEC: btest-diff recv/recv.out
|
||||
# @TEST-EXEC: btest-diff send/send.out
|
||||
|
||||
|
@ -33,7 +33,6 @@ event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
|||
|
||||
event OpenFlow::controller_activated(name: string, controller: OpenFlow::Controller)
|
||||
{
|
||||
continue_processing();
|
||||
OpenFlow::flow_clear(of_controller);
|
||||
OpenFlow::flow_mod(of_controller, [], [$cookie=OpenFlow::generate_cookie(1), $command=OpenFlow::OFPFC_ADD, $actions=[$out_ports=vector(3, 7)]]);
|
||||
}
|
||||
|
@ -61,7 +60,9 @@ function got_message()
|
|||
{
|
||||
++msg_count;
|
||||
|
||||
if ( msg_count == 6 )
|
||||
if ( msg_count == 2 )
|
||||
continue_processing();
|
||||
else if ( msg_count == 6 )
|
||||
terminate();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue