Skip to content

Commit

Permalink
packetbeat/protos{,/amqp}: fix transaction hash size constant
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 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 committed Oct 3, 2023
1 parent 8ace69f commit 8a0ad3f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
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 8a0ad3f

Please sign in to comment.