def serve_forever(self): """Starts the RPC server and serves forever.""" logger.info("RPC server started listening on 0.0.0.0:{}".format( configuration.get_rpc_server_port())) try: self.__server.serve_forever() except gevent.hub.LoopExit: # FIXME: Right now this exception seems to be expected in this situation. Maybe have another look... pass
def __init__(self, interface): """ Args: interface: Interface to provide. """ self.__dispatcher = RPCLoggingDispatcher() transport = WsgiServerTransport(queue_class=gevent.queue.Queue) self._wsgi_server = gevent.wsgi.WSGIServer( ('', configuration.get_rpc_server_port()), transport.handle, log=None) gevent.spawn(self._wsgi_server.serve_forever) self.__server = RPCServerGreenlets(transport, JSONRPCProtocol(), self.__dispatcher) # register interface's public functions self.__dispatcher.register_instance(interface, "")
def __init__(self, interface): """ Args: interface: Interface to provide. """ self.__dispatcher = RPCLoggingDispatcher() transport = WsgiServerTransport(queue_class=gevent.queue.Queue) self._wsgi_server = gevent.wsgi.WSGIServer( ('', configuration.get_rpc_server_port()), transport.handle, log=None) gevent.spawn(self._wsgi_server.serve_forever) self.__server = RPCServerGreenlets( transport, JSONRPCProtocol(), self.__dispatcher ) # register interface's public functions self.__dispatcher.register_instance(interface, "")