mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 18:18:19 +00:00
Allow serialization of closures over Broker.
anonymous-functions, their closures, can now be sent over broker. In order to send an anonymous function the receiver must have parsed a definition of the functon, but it need not to have been evaluated. See testing/btest/language/closure-sending.zeek for an example of how this can be done. This also sends their closures as well as the closures of regular functions.
This commit is contained in:
parent
f18464f1f8
commit
f0798c4b49
19 changed files with 1060 additions and 160 deletions
|
@ -1042,10 +1042,20 @@ void Manager::ProcessEvent(const broker::topic& topic, broker::zeek::Event ev)
|
|||
vl.append(val);
|
||||
else
|
||||
{
|
||||
const char* expected_name = type_name(expected_type->Tag());
|
||||
|
||||
reporter->Warning("failed to convert remote event '%s' arg #%d,"
|
||||
" got %s, expected %s",
|
||||
name.data(), i, got_type,
|
||||
type_name(expected_type->Tag()));
|
||||
" got %s, expected %s",
|
||||
name.data(), i, got_type,
|
||||
expected_name);
|
||||
|
||||
// If we got a vector and expected a function this is possibly because of a mismatch
|
||||
// between anonymous-function bodies.
|
||||
if ( (strcmp( expected_name, "func") == 0) && (strcmp("vector", got_type) == 0) )
|
||||
{
|
||||
reporter->Warning("when sending functions the receiver must have access to a"
|
||||
" version of that function.\nFor anonymous functions, that function must have the same body.");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue