MCPcopy Create free account
hub / github.com/FDio/vpp / _read

Method _read

src/vpp-api/python/vpp_papi/vpp_papi_async.py:692–703  ·  view source on GitHub ↗

Read single complete message, return it or empty on error.

(self, timeout=5, no_type_conversion=False)

Source from the content-addressed store, hash-verified

690 await self.writer.drain()
691
692 async def _read(self, timeout=5, no_type_conversion=False):
693 """Read single complete message, return it or empty on error."""
694 hdr = await self.reader.readexactly(16)
695 if not hdr:
696 return
697 _, hdrlen, _ = self.header_struct.unpack(hdr) # If at head of message
698
699 # Read the rest of the message
700 msg = await self._read_exactly(hdrlen)
701 if hdrlen == len(msg):
702 return self.decode_incoming_msg(msg, no_type_conversion)
703 raise IOError(1, f"Unknown socket read error, read {len(msg)} bytes")
704
705 async def _read_exactly(self, n):
706 """Read exactly n bytes from the reader."""

Callers 1

socket_readerMethod · 0.95

Calls 3

_read_exactlyMethod · 0.95
decode_incoming_msgMethod · 0.95
unpackMethod · 0.45

Tested by

no test coverage detected