Example #1
0
    def _send_message(self, endpoint, msg):
        dst = self.__mock_network.service_containers[endpoint]

        # Exercise the msgpack packing and unpacking.
        frames = msg.pack_frames()
        frames.insert(0, self.endpoint.encode('utf-8'))
        msg = Message.unpack_frames(frames)

        dst.server.recv_message(msg)
Example #2
0
    def _send_message(self, address, msg):
        dst = self.container.lookup(address).connect().endpoint
        dst = self.container._mock_network.service_containers[dst]

        # Exercise the msgpack packing and unpacking.
        frames = msg.pack_frames()
        frames.insert(0, self.endpoint.encode('utf-8'))
        msg = Message.unpack_frames(frames)

        dst.server.recv_message(msg)
Example #3
0
File: rpc.py Project: alazaro/lymph
 def _recv_loop(self):
     while True:
         frames = self.recv_sock.recv_multipart()
         try:
             msg = Message.unpack_frames(frames)
         except ValueError as e:
             msg_id = frames[1] if len(frames) >= 2 else None
             logger.warning('bad message format %s: %r (msg-id=%s)', e, (frames), msg_id)
             continue
         self.recv_message(msg)
Example #4
0
 def recv_loop(self):
     while True:
         frames = self.recv_sock.recv_multipart()
         try:
             msg = Message.unpack_frames(frames)
         except ValueError as e:
             msg_id = frames[1] if len(frames) >= 2 else None
             logger.warning('bad message format %s: %r (msg-id=%s)', e,
                            (frames), msg_id)
             continue
         self.recv_message(msg)