Revert ipc.py socket opts handling
This commit is contained in:
parent
a17c4767d6
commit
01da144a03
@ -139,6 +139,8 @@ class IPCServer(QObject):
|
|||||||
_server: A QLocalServer to accept new connections.
|
_server: A QLocalServer to accept new connections.
|
||||||
_socket: The QLocalSocket we're currently connected to.
|
_socket: The QLocalSocket we're currently connected to.
|
||||||
_socketname: The socketname to use.
|
_socketname: The socketname to use.
|
||||||
|
_socketopts_ok: Set if using setSocketOptions is working with this
|
||||||
|
OS/Qt version.
|
||||||
_atime_timer: Timer to update the atime of the socket regularly.
|
_atime_timer: Timer to update the atime of the socket regularly.
|
||||||
|
|
||||||
Signals:
|
Signals:
|
||||||
@ -180,6 +182,14 @@ class IPCServer(QObject):
|
|||||||
|
|
||||||
self._socket = None
|
self._socket = None
|
||||||
self._old_socket = None
|
self._old_socket = None
|
||||||
|
self._socketopts_ok = os.name == 'nt'
|
||||||
|
if self._socketopts_ok: # pragma: no cover
|
||||||
|
# If we use setSocketOptions on Unix with Qt < 5.4, we get a
|
||||||
|
# NameError while listening...
|
||||||
|
log.ipc.debug("Calling setSocketOptions")
|
||||||
|
self._server.setSocketOptions(QLocalServer.UserAccessOption)
|
||||||
|
else: # pragma: no cover
|
||||||
|
log.ipc.debug("Not calling setSocketOptions")
|
||||||
|
|
||||||
def _remove_server(self):
|
def _remove_server(self):
|
||||||
"""Remove an existing server."""
|
"""Remove an existing server."""
|
||||||
@ -200,14 +210,15 @@ class IPCServer(QObject):
|
|||||||
raise AddressInUseError(self._server)
|
raise AddressInUseError(self._server)
|
||||||
else:
|
else:
|
||||||
raise ListenError(self._server)
|
raise ListenError(self._server)
|
||||||
|
if not self._socketopts_ok: # pragma: no cover
|
||||||
# If we use setSocketOptions on Unix with Qt < 5.4, we get a NameError
|
# If we use setSocketOptions on Unix with Qt < 5.4, we get a
|
||||||
# while listening. (see b135569d5c6e68c735ea83f42e4baf51f7972281)
|
# NameError while listening.
|
||||||
|
# (see b135569d5c6e68c735ea83f42e4baf51f7972281)
|
||||||
#
|
#
|
||||||
# Also, we don't get an AddressInUseError with Qt 5.5:
|
# Also, we don't get an AddressInUseError with Qt 5.5:
|
||||||
# https://bugreports.qt.io/browse/QTBUG-48635
|
# https://bugreports.qt.io/browse/QTBUG-48635
|
||||||
#
|
#
|
||||||
# This means we don't use it at all.
|
# This means we only use setSocketOption on Windows...
|
||||||
try:
|
try:
|
||||||
os.chmod(self._server.fullServerName(), 0o700)
|
os.chmod(self._server.fullServerName(), 0o700)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
|
Loading…
Reference in New Issue
Block a user