mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +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
|
@ -38,18 +38,19 @@ TCP_Reassembler::TCP_Reassembler(analyzer::Analyzer* arg_dst_analyzer,
|
|||
|
||||
if ( ::tcp_contents )
|
||||
{
|
||||
// Val dst_port_val(ntohs(Conn()->RespPort()), TYPE_PORT);
|
||||
PortVal dst_port_val(ntohs(tcp_analyzer->Conn()->RespPort()),
|
||||
auto dst_port_val = port_mgr->Get(ntohs(tcp_analyzer->Conn()->RespPort()),
|
||||
TRANSPORT_TCP);
|
||||
TableVal* ports = IsOrig() ?
|
||||
tcp_content_delivery_ports_orig :
|
||||
tcp_content_delivery_ports_resp;
|
||||
Val* result = ports->Lookup(&dst_port_val);
|
||||
Val* result = ports->Lookup(dst_port_val);
|
||||
|
||||
if ( (IsOrig() && tcp_content_deliver_all_orig) ||
|
||||
(! IsOrig() && tcp_content_deliver_all_resp) ||
|
||||
(result && result->AsBool()) )
|
||||
deliver_tcp_contents = 1;
|
||||
|
||||
Unref(dst_port_val);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue