示例#1
0
 def get_next_client_command(self):
     """
     Read next packet in.  This should only
     be called after a successful handshake
     with the client.
     """
     ipc = IncomingPacketChain()
     ipc.read_in(self.net_fd)
     return ipc.payload.read()
示例#2
0
 def get_next_client_command(self):
     """
     Read next packet in.  This should only
     be called after a successful handshake
     with the client.
     """
     ipc = IncomingPacketChain()
     ipc.read_in(self.net_fd)
     return ipc.payload.read()
示例#3
0
    def runTest(self):
        """
        Single/multi packet processing
        """
        from mysqlproxy.packet import IncomingPacketChain

        proto_buf = StringIO(b'\x01\x00\x00\x00\x01')
        pchain = IncomingPacketChain()
        pchain.read_in(proto_buf)
        self.assertEquals(pchain.chain_length, 1)
        self.assertEquals(pchain.packet_meta[0].length, 1)
        self.assertEquals(pchain.payload.read(), b'\x01')
        self.assertEquals(pchain.total_length, 1)

        proto_buf = StringIO(b'\xff\xff\xff\x00' + b'\xcc'*0xffffff + b'\x00\x00\x00\x01')
        pchain = IncomingPacketChain()
        pchain.read_in(proto_buf)
        self.assertEquals(pchain.chain_length, 2)
        self.assertEquals(len(pchain.packet_meta), 2)
        self.assertEquals(pchain.packet_meta[0].length, 16777215)
        self.assertEquals(pchain.packet_meta[1].length, 0)
        self.assertEquals(pchain.total_length, 0xffffff)