Skip to content

Commit

Permalink
use XPRA_SOCKET_NODELAY to overrule automatic settings
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@18151 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jan 25, 2018
1 parent 838273c commit 77da0a7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
10 changes: 8 additions & 2 deletions src/xpra/net/bytestreams.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
12 changes: 8 additions & 4 deletions src/xpra/net/net_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 77da0a7

Please sign in to comment.