Skip to content

Commit

Permalink
#2420 enable KEEPALIVE by default, add 'keepalive' socket option
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@27681 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Oct 16, 2020
1 parent 958c499 commit c206a42
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/xpra/net/bytestreams.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
log.warn(" %s", cork_e)
SOCKET_CORK = False
SOCKET_NODELAY = envbool("XPRA_SOCKET_NODELAY", None)
SOCKET_KEEPALIVE = envbool("XPRA_SOCKET_KEEPALIVE", True)
VSOCK_TIMEOUT = envint("XPRA_VSOCK_TIMEOUT", 5)
SOCKET_TIMEOUT = envint("XPRA_SOCKET_TIMEOUT", 20)
#this is more proper but would break the proxy server:
Expand Down Expand Up @@ -262,6 +263,11 @@ def boolget(k, default_value):
log("%s options: cork=%s, nodelay=%s", self.socktype_wrapped, self.cork, self.nodelay)
if self.nodelay:
self.do_set_nodelay(self.nodelay)
keepalive = boolget("keepalive", SOCKET_KEEPALIVE)
try:
self._socket.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, int(keepalive))
except OSError:
log("cannot set KEEPALIVE", exc_info=True)
else:
self.cork = False
self.nodelay = False
Expand Down

0 comments on commit c206a42

Please sign in to comment.