diff --git a/src/Expr.h b/src/Expr.h index fe3a9ea6d0..2d0a68a27a 100644 --- a/src/Expr.h +++ b/src/Expr.h @@ -970,12 +970,6 @@ protected: private: std::unique_ptr ingredients; - // I prefer a shared pointer here to copying. Despite the - // list being quite small most of the time, there is much - // copying that happens. - // 1 - when a function is created - // 2 - when that function is called (to create the closure) - // 2 - when a closure is cloned / serialized id_list outer_ids; std::string my_name; }; diff --git a/src/Frame.h b/src/Frame.h index 37b55ca16c..f608e1c03e 100644 --- a/src/Frame.h +++ b/src/Frame.h @@ -173,7 +173,7 @@ public: * * @return the broker representaton, or an error if the serialization * failed. - */ + */ static broker::expected Serialize(const Frame* target, const id_list selection); /** diff --git a/testing/btest/Baseline/language.closure-sending/recv.recv.out b/testing/btest/Baseline/language.closure-sending/recv.recv.out index 451b9cd646..a4d7269e39 100644 --- a/testing/btest/Baseline/language.closure-sending/recv.recv.out +++ b/testing/btest/Baseline/language.closure-sending/recv.recv.out @@ -3,3 +3,24 @@ peer added receiver got ping: function 2 inside: 1 | outside: 11 | global: 100 77 +receiver got ping: function 1 +begin: 100 | base_step: 2 +begin: 100 | base_step: 2 | step: 76 +178 +receiver got ping: function 2 +inside: 3 | outside: 11 | global: 100 +79 +receiver got ping: function 1 +begin: 100 | base_step: 4 +begin: 100 | base_step: 4 | step: 76 +180 +receiver got ping: function 2 +inside: 5 | outside: 11 | global: 100 +81 +receiver got ping: function 1 +begin: 100 | base_step: 6 +begin: 100 | base_step: 6 | step: 76 +182 +receiver got ping: function 2 +inside: 7 | outside: 11 | global: 100 +83 diff --git a/testing/btest/Baseline/language.closure-sending/send.send.out b/testing/btest/Baseline/language.closure-sending/send.send.out index e244b0b6d0..3ff9a31aa4 100644 --- a/testing/btest/Baseline/language.closure-sending/send.send.out +++ b/testing/btest/Baseline/language.closure-sending/send.send.out @@ -5,4 +5,27 @@ sender got pong: function 2 inside: 1 | outside: 11 | global: 10 77 begin: 100 | base_step: 50 +sender got pong: function 1 +begin: 178 | base_step: 2 +begin: 178 | base_step: 2 | step: 76 +256 +begin: 100 | base_step: 50 +sender got pong: function 2 +inside: 3 | outside: 11 | global: 10 +79 +begin: 100 | base_step: 50 +sender got pong: function 1 +begin: 180 | base_step: 4 +begin: 180 | base_step: 4 | step: 76 +260 +begin: 100 | base_step: 50 +sender got pong: function 2 +inside: 5 | outside: 11 | global: 10 +81 +begin: 100 | base_step: 50 +sender got pong: function 1 +begin: 182 | base_step: 6 +begin: 182 | base_step: 6 | step: 76 +264 +begin: 100 | base_step: 50 peer lost diff --git a/testing/btest/Baseline/language.more-closure-tests/out b/testing/btest/Baseline/language.more-closure-tests/out index 7f5d2583be..ec44a36ba7 100644 --- a/testing/btest/Baseline/language.more-closure-tests/out +++ b/testing/btest/Baseline/language.more-closure-tests/out @@ -6,3 +6,10 @@ expect [8, 16, 24] [8, 16, 24] thunder buster +11 +12 +11 +0, dog +1, cat +2, fish +lookup successful diff --git a/testing/btest/language/closure-sending.zeek b/testing/btest/language/closure-sending.zeek index e0356b2b19..c6ff25464c 100644 --- a/testing/btest/language/closure-sending.zeek +++ b/testing/btest/language/closure-sending.zeek @@ -1,11 +1,11 @@ # @TEST-PORT: BROKER_PORT # -# @TEST-EXEC: btest-bg-run send "zeek -B broker -b ../send.zeek >send.out" # @TEST-EXEC: btest-bg-run recv "zeek -B broker -b ../recv.zeek >recv.out" +# @TEST-EXEC: btest-bg-run send "zeek -B broker -b ../send.zeek >send.out" # -# @TEST-EXEC: btest-bg-wait 20 -# @TEST-EXEC: btest-diff send/send.out +# @TEST-EXEC: btest-bg-wait 45 # @TEST-EXEC: btest-diff recv/recv.out +# @TEST-EXEC: btest-diff send/send.out @TEST-START-FILE send.zeek @@ -91,7 +91,7 @@ event pong(msg: string, f: myfunctype) @TEST-START-FILE recv.zeek redef exit_only_after_terminate = T; -const events_to_recv = 3; +const events_to_recv = 7; type myfunctype: function(c: count) : function(d: count) : count; # type myfunctype: function(c: count); @@ -148,13 +148,14 @@ global n = 0; event ping(msg: string, f: myfunctype) { print fmt("receiver got ping: %s", msg); - terminate(); ++n; local adder = f(n); print adder(76); if ( n == events_to_recv ) + { terminate(); + } else { local e = Broker::make_event(pong, msg, f);