mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 01:28:20 +00:00
cluster/Backend: Handle unspecified table/set
Same as what we do in Broker. Use the expected type if publishing a table() or set() parameter. This fixes issues when switching sumstats to Cluster::publish()
This commit is contained in:
parent
d9a74cf32d
commit
fdf783df65
4 changed files with 105 additions and 1 deletions
|
@ -36,9 +36,15 @@ std::optional<zeek::Args> detail::check_args(const zeek::FuncValPtr& handler, ze
|
|||
|
||||
for ( size_t i = 0; i < args.size(); i++ ) {
|
||||
const auto& a = args[i];
|
||||
const auto& got_type = a->GetType();
|
||||
auto got_type = a->GetType();
|
||||
const auto& expected_type = types[i];
|
||||
|
||||
// If called with an unspecified table or set, adopt the expected type
|
||||
// as otherwise same_type() fails.
|
||||
if ( got_type->Tag() == TYPE_TABLE && got_type->AsTableType()->IsUnspecifiedTable() )
|
||||
if ( expected_type->Tag() == TYPE_TABLE && got_type->IsSet() == expected_type->IsSet() )
|
||||
got_type = expected_type;
|
||||
|
||||
if ( ! same_type(got_type, expected_type) ) {
|
||||
zeek::reporter->Error("event parameter #%zu type mismatch, got %s, expecting %s", i + 1,
|
||||
zeek::obj_desc_short(got_type.get()).c_str(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue