From 3ce4d5916c932b369634c90c6a9d98925c688216 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 29 Mar 2021 21:11:26 +0200 Subject: ipc: Hide socket warning when re-getting socket (cherry picked from commit 6de2d238418ddd8d0791584635955d9882618060) --- qutebrowser/misc/ipc.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/qutebrowser/misc/ipc.py b/qutebrowser/misc/ipc.py index 86f0422f3..77b9e8f6c 100644 --- a/qutebrowser/misc/ipc.py +++ b/qutebrowser/misc/ipc.py @@ -356,13 +356,18 @@ class IPCServer(QObject): self.got_args.emit(args, target_arg, cwd) - def _get_socket(self): - """Get the current socket for on_ready_read.""" + def _get_socket(self, warn=True): + """Get the current socket for on_ready_read. + + Arguments: + warn: Whether to warn if no socket was found. + """ if self._socket is None: # pragma: no cover # This happens when doing a connection while another one is already # active for some reason. if self._old_socket is None: - log.ipc.warning("In _get_socket with None socket and old_socket!") + if warn: + log.ipc.warning("In _get_socket with None socket and old_socket!") return None log.ipc.debug("In _get_socket with None socket!") socket = self._old_socket @@ -387,7 +392,7 @@ class IPCServer(QObject): log.ipc.debug("Read from socket 0x{:x}: {!r}".format( id(socket), data)) self._handle_data(data) - socket = self._get_socket() + socket = self._get_socket(warn=False) if self._socket is not None: self._timer.start() -- cgit v1.2.3-54-g00ecf