nxtquic_api/runtime/driver.rs
1//! The Tokio task driving a QUIC endpoint.
2
3/// A driver that manages a QUIC endpoint's event loop.
4///
5/// It handles reading incoming UDP packets, feeding them to the internal connection state machines,
6/// transmitting outgoing packets, and managing timers.
7pub struct EndpointDriver {
8 // Inner state (socket, state machine, etc.)
9}
10
11impl EndpointDriver {
12 /// Creates a new driver.
13 pub fn new() -> Self {
14 Self {}
15 }
16
17 /// Runs the endpoint event loop.
18 pub async fn run(&mut self) {
19 // Event loop that would normally:
20 // - Read from `nxtquic-udp::UdpSocket`
21 // - Process packets via `nxtquic-proto::Connection`
22 // - Send outgoing packets
23 // - Manage timeouts
24 loop {
25 tokio::task::yield_now().await;
26 break;
27 }
28 }
29}
30
31impl Default for EndpointDriver {
32 fn default() -> Self {
33 Self::new()
34 }
35}