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


Commits:
3e4fee24 by Philipp Hörist at 2023-01-17T14:05:44+01:00
fix: Handle race condition when cancelling request

Fixes #136

- - - - -


1 changed file:

- nbxmpp/http.py


Changes:

=====================================
nbxmpp/http.py
=====================================
@@ -449,6 +449,17 @@ class HTTPRequest(GObject.GObject):
             self._set_failed(HTTPRequestError.STATUS_NOT_OK)
             return
 
+        self._log.info('Request status: %s', Soup.Status.get_phrase(status))
+
+        if self._cancellable.is_cancelled():
+            # It can happen that the message is finished before the
+            # response callback returns after calling cancel(). If
+            # we call complete, the response callback will also
+            # try to cleanup and will fail.
+            self._log.info('Skip setting message complete because '
+                           'cancel is in progess')
+            return
+
         self._set_complete()
 
     def _set_failed(self, error: HTTPRequestError) -> None:



View it on GitLab: 
https://dev.gajim.org/gajim/python-nbxmpp/-/commit/3e4fee240f88cf7fed7648ea8cd9181daf919359

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/python-nbxmpp/-/commit/3e4fee240f88cf7fed7648ea8cd9181daf919359
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
Commits@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to