mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
UpdateConnVal: Avoid FieldOffset() calls
These can be significant if a lot of new connections and or events are created for which an existing conn val needs updating and otherwise things are very fast.
This commit is contained in:
parent
c3762ba9d3
commit
01e305edd8
2 changed files with 13 additions and 15 deletions
|
@ -1027,8 +1027,11 @@ void TCPSessionAdapter::FlipRoles() {
|
|||
}
|
||||
|
||||
void TCPSessionAdapter::UpdateConnVal(RecordVal* conn_val) {
|
||||
auto orig_endp_val = conn_val->GetFieldAs<RecordVal>("orig");
|
||||
auto resp_endp_val = conn_val->GetFieldAs<RecordVal>("resp");
|
||||
static const auto& conn_type = zeek::id::find_type<zeek::RecordType>("connection");
|
||||
static const int origidx = conn_type->FieldOffset("orig");
|
||||
static const int respidx = conn_type->FieldOffset("resp");
|
||||
auto* orig_endp_val = conn_val->GetFieldAs<RecordVal>(origidx);
|
||||
auto* resp_endp_val = conn_val->GetFieldAs<RecordVal>(respidx);
|
||||
|
||||
orig_endp_val->Assign(0, orig->Size());
|
||||
orig_endp_val->Assign(1, orig->state);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue