Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mrDoctorWho/vk4xmpp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrDoctorWho <mrdoctorwho@gmail.com>2014-01-03 16:53:42 +0400
committermrDoctorWho <mrdoctorwho@gmail.com>2014-01-03 16:53:42 +0400
commite813a13551e114262f27dba65ca0e9db60b429db (patch)
treeef9cd709e6b032b3edafe6ae7ea308512d57a78d
parent80aea10bf75ca607d45516c7d2dc187bf5c31161 (diff)
Fixed error when transport writes main.disconnect in loop
-rw-r--r--gateway.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/gateway.py b/gateway.py
index 8df6401..4b1e4f0 100644
--- a/gateway.py
+++ b/gateway.py
@@ -614,7 +614,8 @@ def disconnectHandler(crash = True):
if crash:
crashLog("main.disconnect")
try:
- Component.disconnect()
+ if Component.isConnected():
+ Component.disconnect()
except (NameError, AttributeError):
pass
Print("Reconnecting..."); time.sleep(5)
@@ -695,9 +696,11 @@ if __name__ == "__main__":
Component.iter(6)
except AttributeError:
disconnectHandler(False)
+ break ## To be sure that it will restart.
except xmpp.StreamError:
crashLog("Component.iter")
except:
+ break
logger.critical("DISCONNECTED")
crashLog("Component.iter")
disconnectHandler(False)