Hacker News new | past | comments | ask | show | jobs | submit login

Is Cloudflare's Quiche QUIC library https://github.com/cloudflare/quiche similar to what you're looking for? All I/O must be done by the caller.



Yeah, that’s the general idea. Essentially a state machine with a send queue and receive queue, and four operations:

- Input received raw data

- Output received application data

- Input application data to send

- Output raw data to send

Obviously, since TCP connection state is time sensitive, the “raw data” wouldn’t just be the IP packet and headers, but also a time stamp telling the state machine when that packet was received/sent. If you want the state machine to keep track of time even when no packets are being received or sent, there could be an additional operation just to input a timestamp without additional packets. In effect, time is just another input that the user is responsible for feeding to the state machine at sufficiently fine intervals.

In practice, you could emulate this pattern with a callback-oriented protocol stack by populating an in-memory send/receive queue in your callback function, but that design can be somewhat inflexible because it forces potentially undesirable constraints, e.g. an extra memory copy that could otherwise be elided.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: