Repository: qpid-python Updated Branches: refs/heads/master 7400f6ede -> 15ccef2df
QPID-7423: Use generator expression for chunking of big content Project: http://git-wip-us.apache.org/repos/asf/qpid-python/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-python/commit/15ccef2d Tree: http://git-wip-us.apache.org/repos/asf/qpid-python/tree/15ccef2d Diff: http://git-wip-us.apache.org/repos/asf/qpid-python/diff/15ccef2d Branch: refs/heads/master Commit: 15ccef2df869dc4807ef297a667525f55a2220cd Parents: 7400f6e Author: Alex Rudyy <[email protected]> Authored: Wed Sep 14 11:57:32 2016 +0100 Committer: Alex Rudyy <[email protected]> Committed: Wed Sep 14 11:57:32 2016 +0100 ---------------------------------------------------------------------- qpid/peer.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-python/blob/15ccef2d/qpid/peer.py ---------------------------------------------------------------------- diff --git a/qpid/peer.py b/qpid/peer.py index 15f2abf..3025c2e 100644 --- a/qpid/peer.py +++ b/qpid/peer.py @@ -270,14 +270,8 @@ class Channel: # if other type raise ContentError("Content body must be string or buffer, not a %s" % type(content.body)) frame_max = self.client.tune_params['frame_max'] - self.client.conn.AMQP_HEADER_SIZE - start = 0 - remaining_size = len(content.body) - while remaining_size > 0: - chunk_size = min(frame_max, remaining_size) - chunk = content.body[start:start + chunk_size] + for chunk in (content.body[i:i + frame_max] for i in xrange(0, len(content.body), frame_max)): self.write(Body(chunk)) - start += chunk_size - remaining_size -= chunk_size def receive(self, frame, work): if isinstance(frame, Method): --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
