mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 23:58:20 +00:00
Merge remote branch 'origin/topic/jsiwek/pybroccoli-fixes'
* origin/topic/jsiwek/pybroccoli-fixes: Move event arg. record coercion check; now only done for recv'd remote events Update istate.pybroccoli test.
This commit is contained in:
commit
8432258db0
2 changed files with 25 additions and 1 deletions
|
@ -2734,6 +2734,30 @@ void RemoteSerializer::GotEvent(const char* name, double time,
|
||||||
e->handler = event;
|
e->handler = event;
|
||||||
e->args = args;
|
e->args = args;
|
||||||
|
|
||||||
|
// If needed, coerce received record arguments to the expected record type.
|
||||||
|
if ( e->handler->FType() )
|
||||||
|
{
|
||||||
|
const type_list* arg_types = e->handler->FType()->ArgTypes()->Types();
|
||||||
|
loop_over_list(*args, i)
|
||||||
|
{
|
||||||
|
Val* v = (*args)[i];
|
||||||
|
BroType* v_t = v->Type();
|
||||||
|
BroType* arg_t = (*arg_types)[i];
|
||||||
|
if ( v_t->Tag() == TYPE_RECORD && arg_t->Tag() == TYPE_RECORD )
|
||||||
|
{
|
||||||
|
if ( ! same_type(v_t, arg_t) )
|
||||||
|
{
|
||||||
|
Val* nv = v->AsRecordVal()->CoerceTo(arg_t->AsRecordType());
|
||||||
|
if ( nv )
|
||||||
|
{
|
||||||
|
args->replace(i, nv);
|
||||||
|
Unref(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
events.append(e);
|
events.append(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,6 @@ Servus
|
||||||
[a=42, b=6.6.7.7]
|
[a=42, b=6.6.7.7]
|
||||||
42, 6.6.7.7
|
42, 6.6.7.7
|
||||||
==== coerced record
|
==== coerced record
|
||||||
[a=13, b=<uninitialized>, c=helloworld]
|
[one=<uninitialized>, a=13, b=<uninitialized>, c=helloworld, d=<uninitialized>]
|
||||||
13
|
13
|
||||||
helloworld
|
helloworld
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue