Fix a reconnecting regression
This commit is contained in:
parent
33a9780d97
commit
0ff3f9754b
15
hybridbot.py
15
hybridbot.py
@ -135,15 +135,22 @@ class XMPPBot:
|
|||||||
def connect(self):
|
def connect(self):
|
||||||
self.client.connect()
|
self.client.connect()
|
||||||
|
|
||||||
@asyncio.coroutine
|
def join_muc(self):
|
||||||
def join_muc_loop(self):
|
|
||||||
muc_plugin = self.client.plugin['xep_0045']
|
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:
|
while not self.muc_is_joined:
|
||||||
muc_plugin.join_muc(self.muc, self.nick)
|
muc_plugin.join_muc(self.muc, self.nick)
|
||||||
yield from asyncio.sleep(self.timeout)
|
yield from asyncio.sleep(self.timeout)
|
||||||
|
|
||||||
def join_muc(self):
|
self._join_muc_block -= 1
|
||||||
asyncio.async(self.join_muc_loop())
|
|
||||||
|
asyncio.async(loop_cycle())
|
||||||
|
_join_muc_block = 0
|
||||||
|
|
||||||
def on_failed_all_auth(event):
|
def on_failed_all_auth(event):
|
||||||
# print('could not connect!', file=sys.stderr)
|
# print('could not connect!', file=sys.stderr)
|
||||||
|
Loading…
Reference in New Issue
Block a user