Skip to content

Commit

Permalink
max body size is frame_max - 8
Browse files Browse the repository at this point in the history
  • Loading branch information
carlhoerberg committed May 11, 2024
1 parent 0a854c3 commit 8562d0f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/amqp-client/channel.cr
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,9 @@ class AMQP::Client
c.unsafe_write Frame::Basic::Publish.new(@id, 0_u16, exchange, routing_key, mandatory, immediate)
c.unsafe_write Frame::Header.new(@id, 60_u16, 0_u16, bytesize.to_u64, properties)
pos = 0_u32
frame_max = @connection.frame_max
body_max = @connection.frame_max - 8
until pos == bytesize
length = Math.min(frame_max, bytesize.to_u32 - pos)
length = Math.min(body_max, bytesize.to_u32 - pos)
case body
when Bytes
c.unsafe_write Frame::BytesBody.new(@id, length, body[pos.to_i32, length.to_i32])
Expand Down

0 comments on commit 8562d0f

Please sign in to comment.