summaryrefslogtreecommitdiff
path: root/python/qpid/messaging
diff options
context:
space:
mode:
authorRafael H. Schloming <rhs@apache.org>2010-08-02 12:10:52 +0000
committerRafael H. Schloming <rhs@apache.org>2010-08-02 12:10:52 +0000
commit7ae7231562aab29a31aaaf0c4741d32f9a1e6f01 (patch)
treefd8b6a4a25c5cf440672069f7669225105c0f07d /python/qpid/messaging
parent3105021bc9cc72152593c1bce615eabf6720995a (diff)
downloadqpid-python-7ae7231562aab29a31aaaf0c4741d32f9a1e6f01.tar.gz
fixed bug in flow control logic; added tests
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@981474 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/qpid/messaging')
-rw-r--r--python/qpid/messaging/endpoints.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/python/qpid/messaging/endpoints.py b/python/qpid/messaging/endpoints.py
index f989d6c918..7d7d4249a3 100644
--- a/python/qpid/messaging/endpoints.py
+++ b/python/qpid/messaging/endpoints.py
@@ -1009,8 +1009,9 @@ class Receiver(Endpoint, object):
if msg is None:
raise Empty()
elif self._capacity not in (0, UNLIMITED.value):
- if self.received - self.returned <= int(ceil(self.threshold * self._capacity)):
- self.granted = self.received + self._capacity
+ t = int(ceil(self.threshold * self._capacity))
+ if self.received - self.returned <= t:
+ self.granted = self.returned + self._capacity
self._wakeup()
return msg
@@ -1018,7 +1019,7 @@ class Receiver(Endpoint, object):
if self._capacity == UNLIMITED.value:
self.granted = UNLIMITED
else:
- self.granted = self.received + self._capacity
+ self.granted = self.returned + self._capacity
@synchronized
def close(self, timeout=None):