From 77da0a7dc8655c8f0d2f54a370450bddaf81cafc Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Thu, 25 Jan 2018 07:10:52 +0000 Subject: [PATCH] use XPRA_SOCKET_NODELAY to overrule automatic settings git-svn-id: https://xpra.org/svn/Xpra/trunk@18151 3bb7dfac-3a0b-4e04-842a-767bc560f471 --- src/xpra/net/bytestreams.py | 10 ++++++++-- src/xpra/net/net_util.py | 12 ++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/xpra/net/bytestreams.py b/src/xpra/net/bytestreams.py index 6fbd3ccfde..fc8f11e468 100644 --- a/src/xpra/net/bytestreams.py +++ b/src/xpra/net/bytestreams.py @@ -17,7 +17,7 @@ from xpra.platform.features import TCP_OPTIONS, IP_OPTIONS, SOCKET_OPTIONS -SOCKET_NODELAY = envbool("XPRA_SOCKET_NODELAY", True) +SOCKET_NODELAY = envbool("XPRA_SOCKET_NODELAY", None) VSOCK_TIMEOUT = envint("XPRA_VSOCK_TIMEOUT", 5) SOCKET_TIMEOUT = envint("XPRA_SOCKET_TIMEOUT", 20) SSL_PEEK = PYTHON2 and envbool("XPRA_SSL_PEEK", True) @@ -278,9 +278,15 @@ def __init__(self, socket, local, remote, target, socktype, info={}): self.nodelay = None if type(remote)==str: self.filename = remote + if SOCKET_NODELAY is not None: + self.do_set_nodelay(SOCKET_NODELAY) def set_nodelay(self, nodelay): - if self.socktype in ("tcp", "ssl") and self.nodelay!=nodelay: + if SOCKET_NODELAY is None and self.socktype in ("tcp", "ssl") and self.nodelay!=nodelay: + self.do_set_nodelay(nodelay) + + def do_set_nodelay(self, nodelay): + if SOCKET_NODELAY is None and self.socktype in ("tcp", "ssl") and self.nodelay!=nodelay: self._socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, nodelay) self.nodelay = nodelay log("changed %s socket to nodelay=%s", self.socktype, nodelay) diff --git a/src/xpra/net/net_util.py b/src/xpra/net/net_util.py index 0de027c38d..a9b91dc346 100755 --- a/src/xpra/net/net_util.py +++ b/src/xpra/net/net_util.py @@ -303,15 +303,19 @@ def parsenums(v): return net_sys_config def get_net_config(): + config = {} try: from xpra.net.bytestreams import VSOCK_TIMEOUT, SOCKET_TIMEOUT, SOCKET_NODELAY - return { + config = { "vsocket.timeout" : VSOCK_TIMEOUT, "socket.timeout" : SOCKET_TIMEOUT, - "socket.nodelay" : SOCKET_NODELAY, } - except: - return {} + if SOCKET_NODELAY is not None: + config["socket.nodelay"] = SOCKET_NODELAY + except Exception: + log("get_net_config()", exc_info=True) + return config + def get_ssl_info(): try: