Skip to content
This repository has been archived by the owner on Dec 14, 2020. It is now read-only.

Accurately determine transfer header size #75

Open
vcabbage opened this issue Apr 11, 2018 · 0 comments
Open

Accurately determine transfer header size #75

vcabbage opened this issue Apr 11, 2018 · 0 comments

Comments

@vcabbage
Copy link
Owner

Current implementation wastes several bytes on each transfer.

amqp/client.go

Lines 1545 to 1575 in ee6eb7e

const maxTransferFrameHeader = 66 // determined by calcMaxTransferFrameHeader
func calcMaxTransferFrameHeader() int {
var buf buffer
maxUint32 := uint32(math.MaxUint32)
receiverSettleMode := ReceiverSettleMode(0)
err := writeFrame(&buf, frame{
type_: frameTypeAMQP,
channel: math.MaxUint16,
body: &performTransfer{
Handle: maxUint32,
DeliveryID: &maxUint32,
DeliveryTag: bytes.Repeat([]byte{'a'}, 32),
MessageFormat: &maxUint32,
Settled: true,
More: true,
ReceiverSettleMode: &receiverSettleMode,
State: nil, // TODO: determine whether state should be included in size
Resume: true,
Aborted: true,
Batchable: true,
// Payload omitted as it is appended directly without any header
},
})
if err != nil {
panic(err)
}
return buf.len()
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant