diff options
author | John Smith <mrdoctorwho@gmail.com> | 2016-12-28 10:38:56 +0300 |
---|---|---|
committer | John Smith <mrdoctorwho@gmail.com> | 2016-12-28 10:38:56 +0300 |
commit | 71e942add919a282d165ddd06fc7a649740e094d (patch) | |
tree | 59cba5cba6f7434bf6281c9d6b19eb3e2d3441f0 | |
parent | b033a8e6b8ff4738ae2da6ea0fcdc1102aa86883 (diff) |
Correct return codes in longpoll
-rw-r--r-- | library/longpoll.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/library/longpoll.py b/library/longpoll.py index fcf951e..fd3e700 100644 --- a/library/longpoll.py +++ b/library/longpoll.py @@ -311,12 +311,12 @@ class Poll(object): data = read(opener, user.source) result = utils.execute(processPollResult, (user, data,)) debug("longpoll: result=%s (jid: %s)", result, user.source) - if result == -1: + if result == CODE_FINE: return None - # if we'll set user.vk.pollInitialized to False - # then makePoll() will raise an exception - # by doing that, we force the user's poll reinitialization - if not result: + # if we set user.vk.pollInitialized to False + # then makePoll() will throw an exception + # by doing so, we force the user's poll to be reinitialized + if result == CODE_ERROR: user.vk.pollInitialized = False cls.add(user) @@ -328,5 +328,5 @@ class Poll(object): if (time.time() - opener.created) > OPENER_LIFETIME: with cls.__lock: del cls.__list[sock] - cls.processPollResult(user, opener) + cls.processResult(user, opener) time.sleep(SOCKET_CHECK_TIMEOUT) |