diff options
author | Ask Solem <ask@celeryproject.org> | 2014-01-14 21:25:33 +0000 |
---|---|---|
committer | Ask Solem <ask@celeryproject.org> | 2014-01-14 21:25:33 +0000 |
commit | 7e3db2d9e0327d539537f1611a10cbc254886d48 (patch) | |
tree | 0fb6c6e86f9abfdbb06993567ae8ff9c39321e62 | |
parent | 6f4ed3469f2582ff63a8e6c58dd0b451f19ec12e (diff) | |
download | py-amqp-7e3db2d9e0327d539537f1611a10cbc254886d48.tar.gz |
Fixes heartbeat and NoneType error. Closes celery/celery#1790
-rw-r--r-- | amqp/connection.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/amqp/connection.py b/amqp/connection.py index 0580e2e..603e976 100644 --- a/amqp/connection.py +++ b/amqp/connection.py @@ -857,17 +857,18 @@ class Connection(AbstractChannel): want a heartbeat. """ + client_heartbeat = self.client_heartbeat or 0 self.channel_max = args.read_short() or self.channel_max self.frame_max = args.read_long() or self.frame_max self.method_writer.frame_max = self.frame_max - self.server_heartbeat = args.read_short() + self.server_heartbeat = args.read_short() or 0 # negotiate the heartbeat interval to the smaller of the # specified values - if self.server_heartbeat == 0 or self.client_heartbeat == 0: - self.heartbeat = max(self.server_heartbeat, self.client_heartbeat) + if self.server_heartbeat == 0 or client_heartbeat == 0: + self.heartbeat = max(self.server_heartbeat, client_heartbeat) else: - self.heartbeat = min(self.server_heartbeat, self.client_heartbeat) + self.heartbeat = min(self.server_heartbeat, client_heartbeat) self._x_tune_ok(self.channel_max, self.frame_max, self.heartbeat) |