Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/python-nbxmpp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Hörist <philipp@hoerist.com>2023-05-20 09:41:34 +0300
committerPhilipp Hörist <philipp@hoerist.com>2023-05-20 09:41:34 +0300
commit1de40d394f1d9aa96f47db811698b31ce72ae3e3 (patch)
treed2a2a7f64e848482290acb158e93d80ddcaa473a
parent293480a8fb62edacea81b6322b731cbc78ffb163 (diff)
cfix: HTTP: Exit async callbacks early if message is finished
-rw-r--r--nbxmpp/http.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/nbxmpp/http.py b/nbxmpp/http.py
index 1a9ca70..2261618 100644
--- a/nbxmpp/http.py
+++ b/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()