Esempio n. 1
0
 def serve(cls, endpoint, handler):
     if isinstance(endpoint, Server):
         assert False, "TODO"
     else:
         #default is to server using SocketServer, endpoint is addresss
         from concurrence.io.socket import SocketServer
         socket_server = SocketServer(endpoint, handler)
         socket_server.serve()
         return socket_server
Esempio n. 2
0
 def serve_socket(self, addr, socket):
     "Runs a WebService instance accepting connections from given socket"
     try:
         from concurrence.io.socket import SocketServer
         self.socket_server = SocketServer(socket,
                                           self.server.handle_connection)
         self.socket_server.serve()
         self.info("serving %s:%d on shared socket", addr[0], addr[1])
         self.addr = (addr[0], addr[1])
     except Exception as err:
         self.exception("Listen %s:%d: %s", addr[0], addr[1], err)
         os._exit(1)