Skip to content

Commit

Permalink
Avoid firing the state change handler on registration if no
Browse files Browse the repository at this point in the history
transitions have happened yet.
  • Loading branch information
tonyg committed Oct 19, 2009
1 parent 900c34a commit d65852b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rabbitmq/connection.py
Expand Up @@ -151,7 +151,10 @@ def handle_connection_close(self):

def addStateChangeHandler(self, handler, key = None):
self.connection_state_change_event.addHandler(handler, key)
handler(self, self.connection_open)
if self.connection_open:
handler(self, True)
elif self.connection_close:
handler(self, False)

def delStateChangeHandler(self, key):
self.connection_state_change_event.delHandler(key)
Expand Down

0 comments on commit d65852b

Please sign in to comment.