Beispiel #1
0
 def __init__(self, host, port, service_creator, stub_creator):
     super(TcpClient, self).__init__(None, (host, port))
     self.logger = LoggerMgr.get_logger('pyRpc.TcpClient')
     self.service_creator = service_creator
     self.stub_creator = stub_creator
     self.conn_handler = None
     self.channel = None
     self.service = None
     self.stub = None
Beispiel #2
0
    def __init__(self, service, conn):
        super(RpcChannel, self).__init__()
        self.logger = LoggerMgr.get_logger('pyRpc.RpcChannel')
        self.service = service
        self.conn = conn

        self.conn.set_rpc_channel(self)
        self.rpc_controller = RpcController(self)
        self.rpc_parser = RpcParser(self.service, RpcParser.HEAD_FORMAT, RpcParser.INDEX_FORMAT)
Beispiel #3
0
 def __init__(self, host, port, service_creator, stub_creator):
     super(TcpClient, self).__init__(None, (host, port))
     self.logger = LoggerMgr.get_logger('pyRpc.TcpClient')
     self.service_creator = service_creator
     self.stub_creator = stub_creator
     self.conn_handler = None
     self.channel = None
     self.service = None
     self.stub = None
Beispiel #4
0
    def __init__(self, service, conn):
        super(RpcChannel, self).__init__()
        self.logger = LoggerMgr.get_logger('pyRpc.RpcChannel')
        self.service = service
        self.conn = conn

        self.conn.set_rpc_channel(self)
        self.rpc_controller = RpcController(self)
        self.rpc_parser = RpcParser(self.service, RpcParser.HEAD_FORMAT,
                                    RpcParser.INDEX_FORMAT)
Beispiel #5
0
    def __init__(self, service, head_format, index_format):
        self.logger = LoggerMgr.get_logger('pyRpc.RpcParser')
        self.service = service
        self.head_format = head_format
        self.index_format = index_format
        self.head_bytes = struct.calcsize(self.head_format)
        self.index_bytes = struct.calcsize(self.index_format)

        self.buf = ''
        self.status = RpcParser.ST_HEAD
        self.data_bytes = 0
Beispiel #6
0
    def __init__(self, service, head_format, index_format):
        self.logger = LoggerMgr.get_logger('pyRpc.RpcParser')
        self.service = service
        self.head_format = head_format
        self.index_format = index_format
        self.head_bytes = struct.calcsize(self.head_format)
        self.index_bytes = struct.calcsize(self.index_format)

        self.buf = ''
        self.status = RpcParser.ST_HEAD
        self.data_bytes = 0
Beispiel #7
0
    def __init__(self, host, port, service_creator):
        super(TcpServer, self).__init__()
        self.logger = LoggerMgr.get_logger('pyRpc.TcpServer')
        self.host = host
        self.port = port
        self.service_creator = service_creator

        self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
        self.set_reuse_addr()
        self.bind((self.host, self.port))
        self.listen(50)
        self.logger.info('TcpServer.__init__: server listening on %s', str((self.host, self.port)))
Beispiel #8
0
    def __init__(self, host, port, service_creator):
        super(TcpServer, self).__init__()
        self.logger = LoggerMgr.get_logger('pyRpc.TcpServer')
        self.host = host
        self.port = port
        self.service_creator = service_creator

        self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
        self.set_reuse_addr()
        self.bind((self.host, self.port))
        self.listen(50)
        self.logger.info('TcpServer.__init__: server listening on %s',
                         str((self.host, self.port)))
Beispiel #9
0
    def __init__(self, fd, peername):
        super(TcpConnection, self).__init__(fd)
        self.logger = LoggerMgr.getLogger('pyRpc.TcpConnection')
        self.peername = peername

        self.writebuf = ''
        self.readbuf_len = const.RPC_READBUF_LEN
        self.status = TcpConnection.ST_INIT

        if fd:
            self.status = TcpConnection.ST_DISCONNECTED
            self.set_socket_option()
        self.rpc_channel = None
Beispiel #10
0
    def __init__(self, fd, peername):
        super(TcpConnection, self).__init__(fd)
        self.logger = LoggerMgr.getLogger('pyRpc.TcpConnection')
        self.peername = peername

        self.writebuf = ''
        self.readbuf_len = const.RPC_READBUF_LEN
        self.status = TcpConnection.ST_INIT

        if fd:
            self.status = TcpConnection.ST_DISCONNECTED
            self.set_socket_option()
        self.rpc_channel = None