From ddcc1f0e1fac61eec7a4f4f527eb33c687782fd7 Mon Sep 17 00:00:00 2001 From: Kevin Smyth Date: Wed, 17 Jul 2013 13:13:23 -0500 Subject: [PATCH] Use threading instead of multiprocessing on Windows multiprocessing isn't able to copy the socket on Windows: "AttributeError: 'module' object has no attribute 'fromfd'" --- utils/websocket.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/utils/websocket.py b/utils/websocket.py index 3f539a1d..a5ebdec7 100644 --- a/utils/websocket.py +++ b/utils/websocket.py @@ -904,6 +904,17 @@ Sec-WebSocket-Accept: %s\r self.msg('%s: exiting due to --run-once' % address[0]) break + elif sys.platform == 'win32': + import threading + self.vmsg('%s: new handler Thread' % address[0]) + import pickle + selfcopy = pickle.loads(pickle.dumps(self)) + p = threading.Thread( + target=selfcopy.top_new_client, + args=(startsock, address)) + p.daemon = True + p.start() + startsock = None elif multiprocessing: self.vmsg('%s: new handler Process' % address[0]) p = multiprocessing.Process(