mirror of
https://github.com/zeek/zeek.git
synced 2025-10-16 05:28:20 +00:00
reduce memory usage of ConnPolling
Instead of scheduling the event with the full 'connection' record, schedule it with the smaller 'conn_id' record.
This commit is contained in:
parent
eb1a408b6a
commit
f086928c5c
1 changed files with 5 additions and 4 deletions
|
@ -26,14 +26,14 @@ export {
|
||||||
cnt: count, i: interval);
|
cnt: count, i: interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
event ConnPolling::check(c: connection,
|
event ConnPolling::check(id: conn_id,
|
||||||
callback: function(c: connection, cnt: count): interval,
|
callback: function(c: connection, cnt: count): interval,
|
||||||
cnt: count)
|
cnt: count)
|
||||||
{
|
{
|
||||||
if ( ! connection_exists(c$id) )
|
if ( ! connection_exists(id) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lookup_connection(c$id); # updates the conn val
|
local c = lookup_connection(id); # updates the conn val
|
||||||
|
|
||||||
local next_interval = callback(c, cnt);
|
local next_interval = callback(c, cnt);
|
||||||
if ( next_interval < 0secs )
|
if ( next_interval < 0secs )
|
||||||
|
@ -46,5 +46,6 @@ function watch(c: connection,
|
||||||
callback: function(c: connection, cnt: count): interval,
|
callback: function(c: connection, cnt: count): interval,
|
||||||
cnt: count, i: interval)
|
cnt: count, i: interval)
|
||||||
{
|
{
|
||||||
schedule i { ConnPolling::check(c, callback, cnt) };
|
local id = c$id;
|
||||||
|
schedule i { ConnPolling::check(id, callback, cnt) };
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue