diff options
author | Peter Åstrand (astrand) <astrand@cendio.se> | 2013-11-28 13:33:28 +0100 |
---|---|---|
committer | Peter Åstrand (astrand) <astrand@cendio.se> | 2013-11-28 13:33:28 +0100 |
commit | 047ce477423066830e523b937dc8122fc21fcefd (patch) | |
tree | 80e50760f458f328521fad03fe9b2844232a307f | |
parent | 558402848e9fc5b9ec7136144149dd71e3c0c32a (diff) | |
download | websockify-047ce477423066830e523b937dc8122fc21fcefd.tar.gz |
Rename new_client to new_websocket_client, in order to have a better
name in the SocketServer/HTTPServer request handler hierarchy. Prepare
for merge pull request #72. This work has been picked out of
7b3dd8a6f5ef26dbfd6c34a91600ea1613aefaa2 .
-rw-r--r-- | other/websocket.rb | 2 | ||||
-rwxr-xr-x | other/websockify.rb | 2 | ||||
-rwxr-xr-x | tests/echo.py | 2 | ||||
-rwxr-xr-x | tests/echo.rb | 2 | ||||
-rwxr-xr-x | tests/load.py | 2 | ||||
-rw-r--r-- | tests/test_websocketproxy.py | 2 | ||||
-rw-r--r-- | websockify/websocket.py | 10 | ||||
-rwxr-xr-x | websockify/websocketproxy.py | 2 |
8 files changed, 12 insertions, 12 deletions
diff --git a/other/websocket.rb b/other/websocket.rb index d4551a6..bb287ea 100644 --- a/other/websocket.rb +++ b/other/websocket.rb @@ -98,7 +98,7 @@ Sec-WebSocket-Accept: %s\r begin t[:client] = do_handshake(io) - new_client(t[:client]) + new_websocket_client(t[:client]) rescue EClose => e msg "Client closed: #{e.message}" return diff --git a/other/websockify.rb b/other/websockify.rb index d6310f3..e54d0dd 100755 --- a/other/websockify.rb +++ b/other/websockify.rb @@ -39,7 +39,7 @@ Traffic Legend: end # Echo back whatever is received - def new_client(client) + def new_websocket_client(client) msg "connecting to: %s:%s" % [@target_host, @target_port] tsock = TCPSocket.open(@target_host, @target_port) diff --git a/tests/echo.py b/tests/echo.py index 6ad0651..ad83296 100755 --- a/tests/echo.py +++ b/tests/echo.py @@ -20,7 +20,7 @@ class WebSocketEcho(WebSocketServer): client. """ buffer_size = 8096 - def new_client(self): + def new_websocket_client(self): """ Echo back whatever is received. """ diff --git a/tests/echo.rb b/tests/echo.rb index 6a5493c..8db7dd3 100755 --- a/tests/echo.rb +++ b/tests/echo.rb @@ -12,7 +12,7 @@ require 'websocket' class WebSocketEcho < WebSocketServer # Echo back whatever is received - def new_client(client) + def new_websocket_client(client) cqueue = [] c_pend = 0 diff --git a/tests/load.py b/tests/load.py index f142fa1..fdff106 100755 --- a/tests/load.py +++ b/tests/load.py @@ -29,7 +29,7 @@ class WebSocketLoad(WebSocketServer): WebSocketServer.__init__(self, *args, **kwargs) - def new_client(self): + def new_websocket_client(self): self.send_cnt = 0 self.recv_cnt = 0 diff --git a/tests/test_websocketproxy.py b/tests/test_websocketproxy.py index 0fdd0fb..cf940ae 100644 --- a/tests/test_websocketproxy.py +++ b/tests/test_websocketproxy.py @@ -124,4 +124,4 @@ class WebSocketProxyTest(unittest.TestCase): return ins, outs, excepts self.stubs.Set(select, 'select', mock_select) - self.assertRaises(Exception, web_socket_proxy.new_client) + self.assertRaises(Exception, web_socket_proxy.new_websocket_client) diff --git a/websockify/websocket.py b/websockify/websocket.py index eb89a1f..add0337 100644 --- a/websockify/websocket.py +++ b/websockify/websocket.py @@ -68,7 +68,7 @@ if multiprocessing and sys.platform == 'win32': class WebSocketServer(object): """ WebSockets server class. - Must be sub-classed with new_client method definition. + Must be sub-classed with new_websocket_client method definition. """ log_prefix = "websocket" @@ -770,7 +770,7 @@ Sec-WebSocket-Accept: %s\r self.rec.write("var VNC_frame_data = [\n") self.ws_connection = True - self.new_client() + self.new_websocket_client() except self.CClose: # Close the client _, exc, _ = sys.exc_info() @@ -797,15 +797,15 @@ Sec-WebSocket-Accept: %s\r # Original socket closed by caller self.request.close() - def new_client(self): + def new_websocket_client(self): """ Do something with a WebSockets client connection. """ - raise("WebSocketServer.new_client() must be overloaded") + raise("WebSocketServer.new_websocket_client() must be overloaded") def start_server(self): """ Daemonize if requested. Listen for for connections. Run do_handshake() method for each connection. If the connection - is a WebSockets client then call new_client() method (which must + is a WebSockets client then call new_websocket_client() method (which must be overridden) for each new client connection. """ lsock = self.socket(self.listen_host, self.listen_port, False, diff --git a/websockify/websocketproxy.py b/websockify/websocketproxy.py index 0ea37f4..3525df8 100755 --- a/websockify/websocketproxy.py +++ b/websockify/websocketproxy.py @@ -157,7 +157,7 @@ Traffic Legend: # will be run in a separate forked process for each connection. # - def new_client(self): + def new_websocket_client(self): """ Called after a new WebSocket connection has been established. """ |