Skip to content
Snippets Groups Projects
Commit 74aeb774 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

bugfix: messages larger than a frame got corrupted

parent 22c759c9
No related branches found
No related tags found
No related merge requests found
......@@ -468,6 +468,7 @@ class MessageReceiver(object):
self.body.append(payload)
self.data_to_go -= len(payload)
assert self.data_to_go >= 0
if self.data_to_go == 0:
ack_expected = not self.consumer.no_ack
......@@ -496,5 +497,5 @@ class MessageReceiver(object):
self.state = 0
# at this point it's safe to clear the body
self.body = []
# at this point it's safe to clear the body
self.body = []
......@@ -4,6 +4,7 @@ Test things
"""
from __future__ import print_function, absolute_import, division
import six
import os
import unittest
import time, logging, threading, monotonic
from coolamqp.objects import Message, MessageProperties, NodeDefinition, Queue, ReceivedMessage, Exchange
......@@ -33,6 +34,19 @@ class TestA(unittest.TestCase):
fut.result()
con.cancel()
def test_very_long_messages(self):
con, fut = self.c.consume(Queue(u'hello', exclusive=True))
fut.result()
data = six.binary_type(os.urandom(20*1024*1024+1423))
self.c.publish(Message(data), routing_key=b'hello', confirm=True).result()
# rmsg = self.c.drain(3)
# rmsg.ack()
# self.assertEquals(rmsg.body, data)
def test_actually_waits(self):
a = monotonic.monotonic()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment