websocket.py: close lsock on stop.

If WebSocketServer is used as a library with run_once or timeout, then
cleanup the socket listener socket so that when start_server returns
(due to run_once or timeout) then port is freed up.
This commit is contained in:
Joel Martin
2012-10-31 12:04:16 -05:00
parent 47fb367486
commit c00c0eed1a
+5
View File
@@ -941,6 +941,11 @@ Sec-WebSocket-Accept: %s\r
if startsock:
startsock.close()
# Close listen port
self.vmsg("Closing socket listening at %s:%s"
% (self.listen_host, self.listen_port))
lsock.close()
# HTTP handler with WebSocket upgrade support
class WSRequestHandler(SimpleHTTPRequestHandler):