mirror of
https://github.com/zeek/zeek.git
synced 2025-10-16 05:28:20 +00:00
support for transmitting of capture-semantics closures via Broker, while keeping deprecated functionality
This commit is contained in:
parent
e531b2a7ca
commit
80f7d36582
5 changed files with 166 additions and 35 deletions
|
@ -395,7 +395,7 @@ struct val_converter {
|
|||
if ( t->Tag() != TYPE_FUNC )
|
||||
return nullptr;
|
||||
|
||||
if ( a.size() == 2 ) // We have a closure.
|
||||
if ( a.size() == 2 ) // we have a closure/capture frame
|
||||
{
|
||||
auto frame = broker::get_if<broker::vector>(a[1]);
|
||||
if ( ! frame )
|
||||
|
@ -405,8 +405,20 @@ struct val_converter {
|
|||
if ( ! b )
|
||||
return nullptr;
|
||||
|
||||
if ( ! b->UpdateClosure(*frame) )
|
||||
return nullptr;
|
||||
auto copy_semantics =
|
||||
b->GetType()->GetCaptures() != nullptr;
|
||||
|
||||
if ( copy_semantics )
|
||||
{
|
||||
if ( ! b->DeserializeCaptures(*frame) )
|
||||
return nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Support for deprecated serialization.
|
||||
if ( ! b->UpdateClosure(*frame) )
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
return rval;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue