summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2024-05-06 20:51:16 +0200
committerFlorian Bruhin <me@the-compiler.org>2024-05-06 21:00:18 +0200
commitc48e3bce36bd70df2ac33c7afffd1a3a882e177f (patch)
tree8376f7530e85de410922a6ee27582ae601850bd9
parent963c4669919caaef25b6b86ac013597cbcf3c71e (diff)
downloadqutebrowser-c48e3bce36bd70df2ac33c7afffd1a3a882e177f.tar.gz
qutebrowser-c48e3bce36bd70df2ac33c7afffd1a3a882e177f.zip
Ignore timeout
-rw-r--r--qutebrowser/misc/ipc.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/qutebrowser/misc/ipc.py b/qutebrowser/misc/ipc.py
index 72159eab7..0dbb88ae0 100644
--- a/qutebrowser/misc/ipc.py
+++ b/qutebrowser/misc/ipc.py
@@ -168,6 +168,7 @@ class IPCServer(QObject):
self._timer = usertypes.Timer(self, 'ipc-timeout')
self._timer.setInterval(READ_TIMEOUT)
self._timer.timeout.connect(self.on_timeout)
+ self._timer_start_time = None
if utils.is_windows: # pragma: no cover
self._atime_timer = None
@@ -261,6 +262,7 @@ class IPCServer(QObject):
log.ipc.debug("Client connected (socket {}).".format(self._socket_id))
self._socket = socket
self._timer.start()
+ self._timer_start_time = time.monotonic()
socket.readyRead.connect(self.on_ready_read)
if socket.canReadLine():
log.ipc.debug("We can read a line immediately.")
@@ -393,11 +395,23 @@ class IPCServer(QObject):
if self._socket is not None:
self._timer.start()
+ self._timer_start_time = time.monotonic()
@pyqtSlot()
def on_timeout(self):
"""Cancel the current connection if it was idle for too long."""
assert self._socket is not None
+ assert self._timer_start_time is not None
+ if (
+ time.monotonic() - self._timer_start_time < READ_TIMEOUT / 1000 / 10
+ and qtutils.version_check("6.7.0", exact=True, compiled=False)
+ and utils.is_windows
+ ):
+ # WORKAROUND for unknown Qt bug (?) where the timer triggers immediately
+ # https://github.com/qutebrowser/qutebrowser/issues/8191
+ log.ipc.debug("Ignoring early on_timeout call")
+ return
+
log.ipc.error("IPC connection timed out "
"(socket {}).".format(self._socket_id))
self._socket.disconnectFromServer()