mirror of
https://github.com/zeek/zeek.git
synced 2025-10-03 15:18:20 +00:00
Reverting change to const status of network_time. Also, see FIXME: in Func.cc / HandlePluginResult ...
This commit is contained in:
parent
1a456cf9f7
commit
8d04f58eda
5 changed files with 23 additions and 10 deletions
23
src/Func.cc
23
src/Func.cc
|
@ -269,12 +269,28 @@ Val* Func::HandlePluginResult(Val* plugin_result, val_list* args, function_flavo
|
||||||
if ( (! yt) || yt->Tag() == TYPE_VOID )
|
if ( (! yt) || yt->Tag() == TYPE_VOID )
|
||||||
{
|
{
|
||||||
Unref(plugin_result);
|
Unref(plugin_result);
|
||||||
plugin_result = 0;
|
plugin_result = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( plugin_result->Type()->Tag() != yt->Tag() && yt->Tag() != TYPE_ANY)
|
/*
|
||||||
|
FIXME: I know this probably isn't a good idea, but what's the better solution?
|
||||||
|
|
||||||
|
Hack: we want a way to force a NULL return in certain cases (e.g. function delayed). Since no function should ever reasonably return
|
||||||
|
an error, we use the error type to represent this case.
|
||||||
|
|
||||||
|
Note that re-using a type that a function could reasonably return breaks down in the case of e.g. a delayed function, where the function
|
||||||
|
will have a very specific type but still return NULL because things have not yet been evaluated. Thus, if the delayed method returns a
|
||||||
|
bool, and our garbage return value is a bool, then how do we know whether or not the Val* returned by the function is actually meaningful
|
||||||
|
in the general case?
|
||||||
|
*/
|
||||||
|
if ( plugin_result->Type()->Tag() == TYPE_ERROR )
|
||||||
|
{
|
||||||
|
Unref(plugin_result);
|
||||||
|
plugin_result = NULL;
|
||||||
|
}
|
||||||
|
else if ( plugin_result->Type()->Tag() != yt->Tag() && yt->Tag() != TYPE_ANY)
|
||||||
{
|
{
|
||||||
char sbuf[1024];
|
char sbuf[1024];
|
||||||
snprintf(sbuf, 1024, "plugin returned wrong type (got %d, expecting %d) for %s", plugin_result->Type()->Tag(), yt->Tag(), this->Name());
|
snprintf(sbuf, 1024, "plugin returned wrong type (got %d, expecting %d) for %s", plugin_result->Type()->Tag(), yt->Tag(), this->Name());
|
||||||
|
@ -286,11 +302,8 @@ Val* Func::HandlePluginResult(Val* plugin_result, val_list* args, function_flavo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Let the plugin handle the reference counting
|
|
||||||
loop_over_list(*args, i)
|
loop_over_list(*args, i)
|
||||||
Unref((*args)[i]);
|
Unref((*args)[i]);
|
||||||
*/
|
|
||||||
|
|
||||||
return plugin_result;
|
return plugin_result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -645,7 +645,7 @@ void Manager::HookDrainEvents() const
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Manager::HookUpdateNetworkTime(const double network_time) const
|
void Manager::HookUpdateNetworkTime(double network_time) const
|
||||||
{
|
{
|
||||||
HookArgumentList args;
|
HookArgumentList args;
|
||||||
|
|
||||||
|
|
|
@ -261,7 +261,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param network_time The new network time.
|
* @param network_time The new network time.
|
||||||
*/
|
*/
|
||||||
void HookUpdateNetworkTime(const double network_time) const;
|
void HookUpdateNetworkTime(double network_time) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hook that informs plugins that the event queue is being drained.
|
* Hook that informs plugins that the event queue is being drained.
|
||||||
|
|
|
@ -285,7 +285,7 @@ void Plugin::HookDrainEvents()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plugin::HookUpdateNetworkTime(const double network_time)
|
void Plugin::HookUpdateNetworkTime(double network_time)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -605,9 +605,9 @@ protected:
|
||||||
* Hook for updates to network time. This method will be called
|
* Hook for updates to network time. This method will be called
|
||||||
* whenever network time is advanced.
|
* whenever network time is advanced.
|
||||||
*
|
*
|
||||||
* @param networkt_time The new network time.
|
* @param network_time The new network time.
|
||||||
*/
|
*/
|
||||||
virtual void HookUpdateNetworkTime(const double network_time);
|
virtual void HookUpdateNetworkTime(double network_time);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hook for destruction of objects registered with
|
* Hook for destruction of objects registered with
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue