Function libp2p_core::upgrade::read_varint
source · [−]Expand description
Reads a variable-length integer from the socket
.
As a special exception, if the socket
is empty and EOFs right at the beginning, then we
return Ok(0)
.
Note: This function reads bytes one by one from the
socket
. It is therefore encouraged to use some sort of buffering mechanism.