Skip to content

Commit

Permalink
Add xmpp error check to _check_for_notification()
Browse files Browse the repository at this point in the history
It looks like xmpp msg()'s can result in more than one clause
returned by the host, and that only one is processed per msg()
call. If so, it is possible that a failure may not be processed
until the notification call, which does not check.

Add a failure check to the notification method.
  • Loading branch information
davesteele committed Dec 17, 2013
1 parent 39e23bc commit c62d996
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cloudprint/xmpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,14 @@ def _msg(self, msg=None):

def _check_for_notification(self):
"""Check for any notifications which have already been received"""
return self._handler.get_elem() is not None
elem = self._handler.get_elem()

if elem:
assert not elem.tag.endswith('failure') and not elem.tag.endswith('error')
return True
else:
return False


def _send_keepalive(self):
LOGGER.info("Sending XMPP keepalive")
Expand Down

0 comments on commit c62d996

Please sign in to comment.