MCPcopy Create free account
hub / github.com/PerroEngine/Perro / from_stream

Method from_stream

perro_source/api_modules/perro_networking/src/tcp.rs:108–120  ·  view source on GitHub ↗
(stream: TcpStream)

Source from the content-addressed store, hash-verified

106 tx_cursor: usize,
107 read_eof: bool,
108 disconnect_emitted: bool,
109}
110
111impl TcpConnection {
112 pub fn connect<A: ToSocketAddrs>(addr: A) -> NetResult<Self> {
113 let stream = TcpStream::connect(addr)
114 .map_err(|err| NetError::from_io(NetErrorKind::Connect, err))?;
115 Self::from_stream(stream)
116 }
117
118 pub fn from_stream(stream: TcpStream) -> NetResult<Self> {
119 let peer = stream
120 .peer_addr()
121 .map_err(|err| NetError::from_io(NetErrorKind::PeerAddress, err))?;
122 stream
123 .set_nonblocking(true)

Callers

nothing calls this directly

Calls 2

peer_addrMethod · 0.80
set_nonblockingMethod · 0.80

Tested by

no test coverage detected