Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
1de40d39 by Philipp Hörist at 2023-05-20T08:41:34+02:00
cfix: HTTP: Exit async callbacks early if message is finished
- - - - -
1 changed file:
- nbxmpp/http.py
Changes:
=====================================
nbxmpp/http.py
=====================================
@@ -312,6 +312,9 @@ class HTTPRequest(GObject.GObject):
result: Gio.AsyncResult
) -> None:
+ if self._is_finished:
+ return
+
self._log.info('Request response received')
try:
self._input_stream = session.send_finish(result)
@@ -347,6 +350,10 @@ class HTTPRequest(GObject.GObject):
def _on_bytes_read_result(self,
input_stream: Gio.InputStream,
result: Gio.AsyncResult) -> None:
+
+ if self._is_finished:
+ return
+
try:
data = input_stream.read_bytes_finish(result)
except GLib.Error as error:
@@ -504,6 +511,7 @@ class HTTPRequest(GObject.GObject):
self._error = HTTPRequestError.TIMEOUT
else:
self._error = error
+
self._close_all_streams()
self.emit('finished')
self._cleanup()
View it on GitLab:
https://dev.gajim.org/gajim/python-nbxmpp/-/commit/1de40d394f1d9aa96f47db811698b31ce72ae3e3
--
View it on GitLab:
https://dev.gajim.org/gajim/python-nbxmpp/-/commit/1de40d394f1d9aa96f47db811698b31ce72ae3e3
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