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

Method poll_tcp_data

perro_source/api_modules/perro_networking/src/world.rs:312–348  ·  view source on GitHub ↗
(
        &mut self,
        max_per_socket: usize,
        max_bytes: usize,
        events: &mut Vec<NetworkEvent>,
    )

Source from the content-addressed store, hash-verified

310 }
311
312 fn poll_tcp_data(
313 &mut self,
314 max_per_socket: usize,
315 max_bytes: usize,
316 events: &mut Vec<NetworkEvent>,
317 ) {
318 for i in 0..self.tcp_connections.len() {
319 let Some(connection) = self.tcp_connections[i].as_mut() else {
320 continue;
321 };
322 let id = TcpConnectionId(i as u32);
323 for _ in 0..max_per_socket {
324 match connection.poll_event(max_bytes) {
325 Ok(Some(event)) => {
326 let disconnected = matches!(event, NetEvent::TcpDisconnected { .. });
327 events.push(NetworkEvent {
328 source: NetSource::TcpConnection(id),
329 event,
330 });
331 if disconnected {
332 self.tcp_connections[i] = None;
333 break;
334 }
335 }
336 Ok(None) => break,
337 Err(err) => {
338 events.push(net_error_event(
339 NetSource::TcpConnection(id),
340 "tcp_recv",
341 err,
342 ));
343 break;
344 }
345 }
346 }
347 }
348 }
349
350 fn poll_tcp_frames(
351 &mut self,

Callers 2

poll_eventsMethod · 0.80
poll_variant_eventsMethod · 0.80

Calls 6

TcpConnectionIdClass · 0.85
TcpConnectionClass · 0.85
net_error_eventFunction · 0.85
lenMethod · 0.45
poll_eventMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected