Philipp Hörist pushed to branch master at gajim / python-nbxmpp

Commits:
9dcd1fa3 by Yann Leboulanger at 2017-12-08T22:47:55+01:00
send unrequested ack when we haven't acked more than 100 stanza. Fixes
gajim/gajim#8758

- - - - -
53892171 by Philipp Hörist at 2018-01-23T23:39:12+01:00
Merge branch 'master' into 'master'

send unrequested ack when we haven't acked more than 100 stanza

Closes #45 and gajim#8758

See merge request gajim/python-nbxmpp!10
- - - - -


2 changed files:

- nbxmpp/dispatcher_nb.py
- nbxmpp/smacks.py


Changes:

=====================================
nbxmpp/dispatcher_nb.py
=====================================
--- a/nbxmpp/dispatcher_nb.py
+++ b/nbxmpp/dispatcher_nb.py
@@ -589,6 +589,8 @@ class XMPPDispatcher(PlugIn):
 
             if len(self.sm.uqueue) > self.sm.max_queue:
                 self.sm.request_ack()
+            if (self.sm.in_h - self.sm.last_sent_in_h) > 100:
+                self.sm.send_ack()
 
         return ID
 


=====================================
nbxmpp/smacks.py
=====================================
--- a/nbxmpp/smacks.py
+++ b/nbxmpp/smacks.py
@@ -18,6 +18,7 @@ class Smacks(object):
         self.con = con # Connection object
         self.out_h = 0 # Outgoing stanzas handled
         self.in_h = 0  # Incoming stanzas handled
+        self.last_sent_in_h = 0 # Last acked stanza.
         self.uqueue = [] # Unhandled stanzas queue
         self.old_uqueue = [] # Unhandled stanzas queue of the last session
         self.session_id = None
@@ -68,6 +69,7 @@ class Smacks(object):
         log.debug("Clearing smacks uqueue")
         self.uqueue = []
         self.in_h = 0
+        self.last_sent_in_h = 0
         self.out_h = 0
         self.session_id = None
         self.enabled = True
@@ -99,11 +101,13 @@ class Smacks(object):
         self.uqueue = []
         resume = Acks()
         resume.buildResume(self.in_h, self.session_id)
+        self.last_sent_in_h = self.in_h
         self._owner.Connection.send(resume, False)
 
-    def send_ack(self, disp, stanza):
+    def send_ack(self, disp=None, stanza=None):
         ack = Acks()
         ack.buildAnswer(self.in_h)
+        self.last_sent_in_h = self.in_h
         self._owner.Connection.send(ack, False)
     
     def send_closing_ack(self):
@@ -112,6 +116,7 @@ class Smacks(object):
             return
         ack = Acks()
         ack.buildAnswer(self.in_h)
+        self.last_sent_in_h = self.in_h
         self._owner.Connection.send(ack, True)
 
     def request_ack(self):



View it on GitLab: 
https://dev.gajim.org/gajim/python-nbxmpp/compare/5a37180d0f0f901e6eaecf6a8782d9a37e32c0c9...53892171362894b7ad6d16311a93391f3f0fe6fc

---
View it on GitLab: 
https://dev.gajim.org/gajim/python-nbxmpp/compare/5a37180d0f0f901e6eaecf6a8782d9a37e32c0c9...53892171362894b7ad6d16311a93391f3f0fe6fc
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to