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.

(cherry picked from commit df10d97)
  • Loading branch information
efd6 authored and mergify[bot] committed Oct 3, 2023
1 parent d6961d2 commit 68e5953
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
Expand Up @@ -88,6 +88,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
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
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 68e5953

Please sign in to comment.