mirror of
https://github.com/zeek/zeek.git
synced 2025-10-17 14:08:20 +00:00
Preallocate all possible PortVals.
The performance benefit is small (maybe ~1% at most), however, it's a trivial change without downsides.
This commit is contained in:
parent
895e7b06b1
commit
1e4964de77
29 changed files with 139 additions and 68 deletions
|
@ -97,14 +97,14 @@ void UDP_Analyzer::DeliverPacket(int len, const u_char* data, bool is_orig,
|
|||
|
||||
if ( udp_contents )
|
||||
{
|
||||
PortVal port_val(ntohs(up->uh_dport), TRANSPORT_UDP);
|
||||
auto port_val = port_mgr->Get(ntohs(up->uh_dport), TRANSPORT_UDP);
|
||||
Val* result = 0;
|
||||
bool do_udp_contents = false;
|
||||
|
||||
if ( is_orig )
|
||||
{
|
||||
result = udp_content_delivery_ports_orig->Lookup(
|
||||
&port_val);
|
||||
port_val);
|
||||
if ( udp_content_deliver_all_orig ||
|
||||
(result && result->AsBool()) )
|
||||
do_udp_contents = true;
|
||||
|
@ -112,7 +112,7 @@ void UDP_Analyzer::DeliverPacket(int len, const u_char* data, bool is_orig,
|
|||
else
|
||||
{
|
||||
result = udp_content_delivery_ports_resp->Lookup(
|
||||
&port_val);
|
||||
port_val);
|
||||
if ( udp_content_deliver_all_resp ||
|
||||
(result && result->AsBool()) )
|
||||
do_udp_contents = true;
|
||||
|
@ -126,6 +126,8 @@ void UDP_Analyzer::DeliverPacket(int len, const u_char* data, bool is_orig,
|
|||
vl->append(new StringVal(len, (const char*) data));
|
||||
ConnectionEvent(udp_contents, vl);
|
||||
}
|
||||
|
||||
Unref(port_val);
|
||||
}
|
||||
|
||||
if ( is_orig )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue