def Recv(self):
    """Accept a message from Fleetspeak.

    Returns:
      A tuple (common_pb2.Message, size of the message in bytes).
    Raises:
      ProtocolError: If we receive unexpected data from Fleetspeak.
    """
    size = struct.unpack(_STRUCT_FMT, self._ReadN(_STRUCT_LEN))[0]
    if size > MAX_SIZE:
      raise ProtocolError("Expected size to be at most %d, got %d" % (MAX_SIZE,
                                                                      size))
    with self._read_lock:
      buf = self._ReadN(size)
      self._ReadMagic()

    res = common_pb2.Message()
    res.ParseFromString(buf)

    return res, len(buf)
def Recv ( self ) : size = struct . unpack ( _STRUCT_FMT , self . _ReadN ( _STRUCT_LEN ) ) [ 0 ] if size > MAX_SIZE : raise ProtocolError ( "Expected size to be at most %d, got %d" % ( MAX_SIZE , size ) ) with self . _read_lock : buf = self . _ReadN ( size ) self . _ReadMagic ( ) res = common_pb2 . Message ( ) res . ParseFromString ( buf ) return res , len ( buf )
Accept a message from Fleetspeak.

    Returns:
      A tuple (common_pb2.Message, size of the message in bytes).
    Raises:
      ProtocolError: If we receive unexpected data from Fleetspeak.