Skip to content

Commit

Permalink
Merge pull request #537 from vitaly-krugl/fix-closing-args
Browse files Browse the repository at this point in the history
Fix #535, allowing the expected `reply_code` and `reply_text` to be passed to `on_close_callback`
  • Loading branch information
gmr committed Apr 29, 2015
2 parents 593dda4 + 0c9be99 commit 64b3770
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pika/connection.py
Expand Up @@ -1188,6 +1188,9 @@ def _on_connection_closed(self, method_frame, from_adapter=False):
self.closing = (method_frame.method.reply_code,
method_frame.method.reply_text)

# Save the codes because self.closing gets reset by _adapter_disconnect
reply_code, reply_text = self.closing

# Stop the heartbeat checker if it exists
if self.heartbeat:
self.heartbeat.stop()
Expand All @@ -1197,7 +1200,7 @@ def _on_connection_closed(self, method_frame, from_adapter=False):
self._adapter_disconnect()

# Invoke a method frame neutral close
self._on_disconnect(self.closing[0], self.closing[1])
self._on_disconnect(reply_code, reply_text)

def _on_connection_error(self, connection_unused, error_message=None):
"""Default behavior when the connecting connection can not connect.
Expand Down

0 comments on commit 64b3770

Please sign in to comment.