Some applications need timers, as in "wake me up if there is no message from the peer before time T. It would nice to be able to set these timers in "virtual time", so timers could be tested using the simulation infrastructure.
Any timer API would need three components:
setting a timer, as in "wake up this context after N microseconds"
resetting the timer, as in "instead of N microseconds, wait P microseconds"
waking the application when the timer expires.
We may consider timer support at the connection or stream level -- acting at the QUIC level would not make much sense, as the application can just do it outside of the QUIC loop. Of the two, implementation at the connection level is easiest, because we already have similar tests for the "idle" timer. Stream level action is plausible, but would require extra code to sort the streams by "next timer".
Plausible design: application creates and maintain "timer objects" tied to a connection. Picoquic organizes a splay of timer objects per connection. Application can insert an object in the splay, or reset it -- the splay stays updated. Application deletes the timers when they expire. Context in case of interaction is the timer object, as defined by the application.
Some applications need timers, as in "wake me up if there is no message from the peer before time T. It would nice to be able to set these timers in "virtual time", so timers could be tested using the simulation infrastructure.
Any timer API would need three components:
We may consider timer support at the connection or stream level -- acting at the QUIC level would not make much sense, as the application can just do it outside of the QUIC loop. Of the two, implementation at the connection level is easiest, because we already have similar tests for the "idle" timer. Stream level action is plausible, but would require extra code to sort the streams by "next timer".
Plausible design: application creates and maintain "timer objects" tied to a connection. Picoquic organizes a splay of timer objects per connection. Application can insert an object in the splay, or reset it -- the splay stays updated. Application deletes the timers when they expire. Context in case of interaction is the timer object, as defined by the application.