diff --git a/slixmpp_omemo/__init__.py b/slixmpp_omemo/__init__.py index b885d8b..f35440d 100644 --- a/slixmpp_omemo/__init__.py +++ b/slixmpp_omemo/__init__.py @@ -536,8 +536,8 @@ class XEP_0384(BasePlugin): if session is None: continue skr = session._DoubleRatchet__skr - sending = skr.sending_chain_length or -1 - receiving = skr.receiving_chain_length or -1 + sending = skr.sending_chain_length or 0 + receiving = skr.receiving_chain_length or 0 lengths['sending'].append((did, sending)) lengths['receiving'].append((did, receiving)) @@ -556,8 +556,7 @@ class XEP_0384(BasePlugin): receiving_chain_lengths = self._chain_lengths(jid).get('receiving', []) lengths = map(lambda d_l: d_l[1], receiving_chain_lengths) - min_length = reduce(lambda x, d_l: min(x, d_l[1]), receiving_chain_lengths, 0) == -1 - return min_length == -1 or max(lengths, default=0) > self.heartbeat_after + return max(lengths, default=0) > self.heartbeat_after async def make_heartbeat(self, jid: JID) -> Message: """