mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Add methods to queue events without handler existence check
Added ConnectionEventFast() and QueueEventFast() methods to avoid redundant event handler existence checks. It's common practice for caller to already check for event handler existence before doing all the work of constructing the arguments, so it's desirable to not have to check for existence again. E.g. going through ConnectionEvent() means 3 existence checks: one you do yourself before calling it, one in ConnectionEvent(), and then another in QueueEvent(). The existence check itself can be more than a few operations sometimes as it needs to check a few flags that determine if it's enabled, has a local body, or has any remote receivers in the old comm. system or has been flagged as something to publish in the new comm. system.
This commit is contained in:
parent
8bc65f09ec
commit
b6862c5c59
72 changed files with 771 additions and 524 deletions
|
@ -136,7 +136,7 @@ void TCP_Reassembler::Gap(uint64 seq, uint64 len)
|
|||
|
||||
if ( report_gap(endp, endp->peer) )
|
||||
{
|
||||
dst_analyzer->ConnectionEvent(content_gap, {
|
||||
dst_analyzer->ConnectionEventFast(content_gap, {
|
||||
dst_analyzer->BuildConnVal(),
|
||||
val_mgr->GetBool(IsOrig()),
|
||||
val_mgr->GetCount(seq),
|
||||
|
@ -335,7 +335,7 @@ void TCP_Reassembler::RecordBlock(DataBlock* b, BroFile* f)
|
|||
|
||||
if ( contents_file_write_failure )
|
||||
{
|
||||
tcp_analyzer->ConnectionEvent(contents_file_write_failure, {
|
||||
tcp_analyzer->ConnectionEventFast(contents_file_write_failure, {
|
||||
Endpoint()->Conn()->BuildConnVal(),
|
||||
val_mgr->GetBool(IsOrig()),
|
||||
new StringVal("TCP reassembler content write failure"),
|
||||
|
@ -352,7 +352,7 @@ void TCP_Reassembler::RecordGap(uint64 start_seq, uint64 upper_seq, BroFile* f)
|
|||
|
||||
if ( contents_file_write_failure )
|
||||
{
|
||||
tcp_analyzer->ConnectionEvent(contents_file_write_failure, {
|
||||
tcp_analyzer->ConnectionEventFast(contents_file_write_failure, {
|
||||
Endpoint()->Conn()->BuildConnVal(),
|
||||
val_mgr->GetBool(IsOrig()),
|
||||
new StringVal("TCP reassembler gap write failure"),
|
||||
|
@ -425,7 +425,7 @@ void TCP_Reassembler::Overlap(const u_char* b1, const u_char* b2, uint64 n)
|
|||
BroString* b1_s = new BroString((const u_char*) b1, n, 0);
|
||||
BroString* b2_s = new BroString((const u_char*) b2, n, 0);
|
||||
|
||||
tcp_analyzer->ConnectionEvent(rexmit_inconsistency, {
|
||||
tcp_analyzer->ConnectionEventFast(rexmit_inconsistency, {
|
||||
tcp_analyzer->BuildConnVal(),
|
||||
new StringVal(b1_s),
|
||||
new StringVal(b2_s),
|
||||
|
@ -596,7 +596,7 @@ void TCP_Reassembler::DeliverBlock(uint64 seq, int len, const u_char* data)
|
|||
|
||||
if ( deliver_tcp_contents )
|
||||
{
|
||||
tcp_analyzer->ConnectionEvent(tcp_contents, {
|
||||
tcp_analyzer->ConnectionEventFast(tcp_contents, {
|
||||
tcp_analyzer->BuildConnVal(),
|
||||
val_mgr->GetBool(IsOrig()),
|
||||
val_mgr->GetCount(seq),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue