make_heartbeat needs to be async
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
95481e64b2
commit
7e079f4260
1 changed files with 6 additions and 4 deletions
|
@ -538,7 +538,7 @@ class XEP_0384(BasePlugin):
|
|||
lengths = map(lambda d_l: d_l[1], receiving_chain_lengths)
|
||||
return max(lengths, default=0) > self.heartbeat_after
|
||||
|
||||
def make_heartbeat(self, jid: JID) -> Message:
|
||||
async def make_heartbeat(self, jid: JID) -> Message:
|
||||
"""
|
||||
Returns a heartbeat message.
|
||||
|
||||
|
@ -548,7 +548,7 @@ class XEP_0384(BasePlugin):
|
|||
"""
|
||||
|
||||
msg = self.xmpp.make_message(mto=jid)
|
||||
encrypted = self.encrypt_key_transport_message(
|
||||
encrypted = await self.encrypt_key_transport_message(
|
||||
plaintext=None,
|
||||
recipients=[jid],
|
||||
expect_problems=None,
|
||||
|
@ -644,8 +644,10 @@ class XEP_0384(BasePlugin):
|
|||
asyncio.ensure_future(self._publish_bundle())
|
||||
|
||||
if self.auto_heartbeat and self.should_heartbeat():
|
||||
msg = self.make_heartbeat(jid)
|
||||
msg.send()
|
||||
async def send_heartbeat():
|
||||
msg = await self.make_heartbeat(JID(jid))
|
||||
msg.send()
|
||||
asyncio.ensure_future(send_heartbeat())
|
||||
|
||||
return body
|
||||
|
||||
|
|
Loading…
Reference in a new issue