From 302f743fee2ad4744b059a85d39fbea507423604 Mon Sep 17 00:00:00 2001
From: Piotr Maslanka <piotr.maslanka@henrietta.com.pl>
Date: Fri, 13 Jan 2017 22:03:12 +0100
Subject: [PATCH] incorrect assertion

---
 coolamqp/uplink/connection/recv_framer.py | 8 +++++++-
 coolamqp/uplink/handshake.py              | 2 +-
 setup.py                                  | 4 ++--
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/coolamqp/uplink/connection/recv_framer.py b/coolamqp/uplink/connection/recv_framer.py
index 1a70546..58aab46 100644
--- a/coolamqp/uplink/connection/recv_framer.py
+++ b/coolamqp/uplink/connection/recv_framer.py
@@ -69,6 +69,8 @@ class ReceivingFramer(object):
             self.chunks[0] = self.chunks[0][up_to:]
 
         self.total_data_len -= len(q)
+        assert len(q) <= up_to, 'extracted %s but %s was requested' % (len(q), up_to)
+        print('Returning %s bytes - %s' % (len(q), repr(q)))
         return q
 
     def _statemachine(self):
@@ -82,6 +84,8 @@ class ReceivingFramer(object):
             if self.frame_type not in (FRAME_HEARTBEAT, FRAME_HEADER, FRAME_METHOD, FRAME_BODY):
                 raise ValueError('Invalid frame')
 
+            print('Rolling with', self.frame_type)
+
             return True
 
         # state rule 2
@@ -107,6 +111,8 @@ class ReceivingFramer(object):
 
             self.frame_channel, self.frame_size = struct.unpack('!HI',hdr)
 
+            print('Regarding', self.frame_channel, 'size', self.frame_size)
+
             return True
 
         # state rule 4
@@ -121,7 +127,7 @@ class ReceivingFramer(object):
                 while payload.tell() < self.frame_size:
                     payload.write(self._extract(self.frame_size - payload.tell()))
 
-                assert payload.tell() <= self.total_data_len
+                assert payload.tell() <= self.frame_size
 
                 payload = memoryview(payload.getvalue())
 
diff --git a/coolamqp/uplink/handshake.py b/coolamqp/uplink/handshake.py
index 4fe0b66..8544cdb 100644
--- a/coolamqp/uplink/handshake.py
+++ b/coolamqp/uplink/handshake.py
@@ -22,7 +22,7 @@ CLIENT_DATA = [
         # because RabbitMQ is some kind of a fascist and does not allow
         # these fields to be of type short-string
         (b'product', (b'CoolAMQP', 'S')),
-        (b'version', (b'0.84', 'S')),
+        (b'version', (b'0.85', 'S')),
         (b'copyright', (b'Copyright (C) 2016-2017 DMS Serwis', 'S')),
         (b'information', (b'Licensed under the MIT License.\nSee https://github.com/smok-serwis/coolamqp for details', 'S')),
         (b'capabilities', ([(capa, (True, 't')) for capa in SUPPORTED_EXTENSIONS], 'F')),
diff --git a/setup.py b/setup.py
index 5d940b3..b2c3afb 100644
--- a/setup.py
+++ b/setup.py
@@ -4,12 +4,12 @@ from setuptools import setup
 
 
 setup(name=u'CoolAMQP',
-      version='0.84',
+      version='0.85',
       description=u'The fastest AMQP client',
       author=u'DMS Serwis s.c.',
       author_email=u'piotrm@smok.co',
       url=u'https://github.com/smok-serwis/coolamqp',
-      download_url='https://github.com/smok-serwis/coolamqp/archive/v0.84.zip',
+      download_url='https://github.com/smok-serwis/coolamqp/archive/v0.85.zip',
       keywords=['amqp', 'rabbitmq', 'client', 'network', 'ha', 'high availability'],
       packages=[
           'coolamqp',
-- 
GitLab