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

Method read_into_frame_buf

perro_source/api_modules/perro_networking/src/tcp.rs:206–227  ·  view source on GitHub ↗
(&mut self, max_frame_bytes: usize)

Source from the content-addressed store, hash-verified

204 if let Some(frame) = decode_next_queued_frame(&mut self.frame_buf, max_frame_bytes)? {
205 return Ok(Some(frame));
206 }
207 self.read_into_frame_buf(max_frame_bytes)?;
208 decode_next_queued_frame(&mut self.frame_buf, max_frame_bytes)
209 }
210
211 pub fn poll_frame_event(&mut self, max_frame_bytes: usize) -> NetResult<Option<NetEvent>> {
212 let peer = self.peer_string();
213 let Some(bytes) = self.poll_frame(max_frame_bytes)? else {
214 if self.read_eof && !self.disconnect_emitted {
215 self.frame_buf.clear();
216 self.disconnect_emitted = true;
217 return Ok(Some(NetEvent::TcpDisconnected { peer }));
218 }
219 return Ok(None);
220 };
221 if is_heartbeat_ping(&bytes) {
222 return Ok(Some(NetEvent::HeartbeatPing { peer }));
223 }
224 if is_heartbeat_pong(&bytes) {
225 return Ok(Some(NetEvent::HeartbeatPong { peer }));
226 }
227 Ok(Some(NetEvent::TcpFrame { peer, bytes }))
228 }
229
230 pub fn poll_handshake(&mut self, max_frame_bytes: usize) -> NetResult<Option<NetHandshake>> {

Callers 1

poll_frameMethod · 0.80

Calls 3

kindMethod · 0.80
readMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected