Fix a reconnecting regression

This commit is contained in:
Alexei Sorokin 2017-06-19 19:47:42 +03:00
parent 33a9780d97
commit 0ff3f9754b

View File

@ -135,15 +135,22 @@ class XMPPBot:
def connect(self):
self.client.connect()
@asyncio.coroutine
def join_muc_loop(self):
muc_plugin = self.client.plugin['xep_0045']
while not self.muc_is_joined:
muc_plugin.join_muc(self.muc, self.nick)
yield from asyncio.sleep(self.timeout)
def join_muc(self):
asyncio.async(self.join_muc_loop())
muc_plugin = self.client.plugin['xep_0045']
@asyncio.coroutine
def loop_cycle():
if self._join_muc_block > 0:
return
self._join_muc_block += 1
while not self.muc_is_joined:
muc_plugin.join_muc(self.muc, self.nick)
yield from asyncio.sleep(self.timeout)
self._join_muc_block -= 1
asyncio.async(loop_cycle())
_join_muc_block = 0
def on_failed_all_auth(event):
# print('could not connect!', file=sys.stderr)