Skip to content

Commit

Permalink
packetbeat/protos{,/amqp}: fix transaction hash size constant (#36723)
Browse files Browse the repository at this point in the history
The transaction hash size is currently calculated as 2⊕16 (18) which
is most likely not what was intended. The code entered the code base in
the initial import which does not have an associated review. However,
the symbol ^ signifies exponent in other languages, and XOR is almost never
what someone would use for defining a constant like this, so it is very
likely that the original author intended a 64Ki cache size.
  • Loading branch information
efd6 authored Oct 3, 2023
1 parent 8818aca commit df10d97
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]

*Packetbeat*

- Fix default cache size calculation. {pull}36723[36723]

*Winlogbeat*

Expand Down
2 changes: 1 addition & 1 deletion packetbeat/protos/amqp/amqp_structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
type amqpMethod func(*amqpMessage, []byte) (bool, bool)

const (
transactionsHashSize = 2 ^ 16
transactionsHashSize = 1 << 16
transactionTimeout = 10 * 1e9
)

Expand Down
2 changes: 1 addition & 1 deletion packetbeat/protos/protos.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
)

const (
DefaultTransactionHashSize = 2 ^ 16
DefaultTransactionHashSize = 1 << 16
DefaultTransactionExpiration time.Duration = 10 * time.Second
)

Expand Down

0 comments on commit df10d97

Please sign in to comment.