Browse files

FIX for max frame size handling

Connection.frame_max limits the *total* frame size, including header and end
marker, which add up to 8 octets in total. Hence body fragmentation
should occur in chunks of frame_max-8.

stormed-amqp was sending frames that could be 8 octets too large.

bug reported by Matthias Radestock.
  • Loading branch information...
1 parent 851b162 commit 7053d1fe1516dea4759c524aba95855db82b9a8a @paolo-losi committed Jun 21, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 stormed/frame.py
View
2 stormed/frame.py
@@ -74,7 +74,7 @@ def content_header_from_msg(msg, ch):
return '%s%s%s' % (header, payload, '\xCE')
def body_frames_from_msg(msg, ch):
- max_size = ch.conn.frame_max
+ max_size = ch.conn.frame_max - frame_header.size - 1 # 1 -> end marker size
frames = []
for offset in range(0, len(msg.body), max_size):
payload = msg.body[offset:offset + max_size]

0 comments on commit 7053d1f

Please sign in to comment.