From 53344befd155453c372b837ec03fb7e9a16cc1ca Mon Sep 17 00:00:00 2001 From: Alexander Kozlovsky Date: Mon, 29 Aug 2022 10:55:07 +0200 Subject: [PATCH] An attempt to fix QNetworkReply.UnknownNetworkError (99) when connecting to Core --- src/tribler/gui/event_request_manager.py | 4 ++++ src/tribler/gui/tribler_request_manager.py | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/tribler/gui/event_request_manager.py b/src/tribler/gui/event_request_manager.py index 87e8255c77a..5609c93e72b 100644 --- a/src/tribler/gui/event_request_manager.py +++ b/src/tribler/gui/event_request_manager.py @@ -167,6 +167,10 @@ def connect(self, reschedule_on_err=True): self._logger.info(f"Connecting to events endpoint ({'with' if reschedule_on_err else 'without'} retrying)") if self.reply is not None: self.reply.deleteLater() + + # A workaround for Qt5 bug. See https://github.com/Tribler/tribler/issues/7018 + self.setNetworkAccessible(QNetworkAccessManager.Accessible) + self.reply = self.get(self.request) connect(self.reply.readyRead, self.on_read_data) diff --git a/src/tribler/gui/tribler_request_manager.py b/src/tribler/gui/tribler_request_manager.py index e47982e4ef5..b877e547262 100644 --- a/src/tribler/gui/tribler_request_manager.py +++ b/src/tribler/gui/tribler_request_manager.py @@ -113,6 +113,9 @@ def add_request(self, request): buf.setData(request.raw_data) buf.open(QIODevice.ReadOnly) + # A workaround for Qt5 bug. See https://github.com/Tribler/tribler/issues/7018 + self.setNetworkAccessible(QNetworkAccessManager.Accessible) + request.reply = self.sendCustomRequest(qt_request, request.method.encode("utf8"), buf) buf.setParent(request.reply)