Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* the http server fails on win32 unless we set the sockets to blocking mode
* no need to override send and recv unless we're websockifying and on win32

git-svn-id: https://xpra.org/svn/Xpra/trunk@13866 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Sep 25, 2016
1 parent bb1944e commit 460f54a
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/xpra/server/server_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,24 +685,20 @@ def start_websockify(self, conn, frominfo):
from xpra.net.websocket import WebSocketConnection, WSRequestHandler
try:
sock = conn._socket
# win32 servers don't seem to honour our request to use blocking sockets
# (this workaround should not be needed on any other platform,
# and maybe this should go in websockify somewhere instead)
from xpra.net.bytestreams import untilConcludes
WIN32 = sys.platform.startswith("win")
if WIN32:
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
#the HTTP server fails on win32 if we don't use blocking sockets!
sock.setblocking(True)
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)
if WIN32:
# win32 servers don't seem to honour our request to use blocking sockets
# (this workaround should not be needed on any other platform,
# and maybe this should go in websockify somewhere instead)
from xpra.net.bytestreams import untilConcludes
saved_recv = sock.recv
saved_send = sock.send
#now we can have a "is_active" that belongs to the real connection object:
def recv(*args):
return untilConcludes(wsc.is_active, saved_recv, *args)
Expand Down

0 comments on commit 460f54a

Please sign in to comment.