Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* use the correct is_active function to exit the IO loops
* set a lower timeout value so we can steal the connection more quickly

git-svn-id: https://xpra.org/svn/Xpra/trunk@13862 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Sep 25, 2016
1 parent a2d2ee1 commit cfc469d
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions src/xpra/server/server_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,22 +689,28 @@ def start_websockify(self, conn, frominfo):
# * win32 servers don't seem to honour our request to use blocking sockets anyway
# (this should not be needed on any other platform,
# maybe this should go in websockify somewhere instead)
# * the proxy server needs this to steal the connection?
# * the proxy server needs this to steal the connection
sock.setblocking(False)
sock.settimeout(1.0)
if sys.platform.startswith("win"):
from xpra.net.bytestreams import untilConcludes
saved_recv = sock.recv
saved_send = sock.send
sock.settimeout(0.1)
from xpra.net.bytestreams import untilConcludes
saved_recv = sock.recv
saved_send = sock.send
def recv(*args):
return untilConcludes(conn.is_active, saved_recv, *args)
def send(*args):
return untilConcludes(conn.is_active, saved_send, *args)
sock.recv = recv
sock.send = send
def new_websocket_client(wsh):
netlog("new_websocket_client(%s) socket=%s", wsh, sock)
wsc = WebSocketConnection(sock, conn.local, conn.remote, conn.target, conn.socktype, wsh)
#now we can have a "is_active" that belongs to the real connection object:
def recv(*args):
return untilConcludes(conn.is_active, saved_recv, *args)
return untilConcludes(wsc.is_active, saved_recv, *args)
def send(*args):
return untilConcludes(conn.is_active, saved_send, *args)
return untilConcludes(wsc.is_active, saved_send, *args)
sock.recv = recv
sock.send = send
def new_websocket_client(wsh):
netlog("new_websocket_client(%s) socket=%s", wsh, sock)
wsc = WebSocketConnection(sock, conn.local, conn.remote, conn.target, conn.socktype, wsh)
self.make_protocol("tcp", wsc, frominfo)
WSRequestHandler(sock, frominfo, new_websocket_client, self._www_dir)
return
Expand Down

0 comments on commit cfc469d

Please sign in to comment.