REGRESSION (r217572): run-webkit-tests exits without emitting newline character
[WebKit.git] / Tools / Scripts / webkitpy / layout_tests / servers / websocket_server.py
index 4d4f5b7..944f9cb 100644 (file)
 
 """A class to help start/stop the PyWebSocket server used by layout tests."""
 
-import errno
 import logging
 import os
-import socket
 import sys
 import time
 
-from webkitpy.layout_tests.servers import http_server
-from webkitpy.layout_tests.servers import http_server_base
+from webkitpy.layout_tests.servers import http_server, http_server_base
 
 _log = logging.getLogger(__name__)
 
@@ -108,18 +105,6 @@ class PyWebSocket(http_server.Lighttpd):
         else:
             self._log_prefix = _WS_LOG_NAME
 
-    def is_running(self):
-        s = socket.socket()
-        try:
-            s.connect(('localhost', self._port))
-        except IOError as e:
-            if e.errno not in (errno.ECONNREFUSED, errno.ECONNRESET):
-                raise
-            return False
-        finally:
-            s.close()
-        return True
-
     def ports_to_forward(self):
         return [self._port]
 
@@ -190,3 +175,7 @@ class PyWebSocket(http_server.Lighttpd):
         if self._wsout:
             self._wsout.close()
             self._wsout = None
+
+
+def is_web_socket_server_running():
+    return http_server_base.HttpServerBase._is_running_on_port(PyWebSocket.DEFAULT_WS_PORT)