Is it possible to register multiple timeouts in mio?

118 views Asked by At

I have written a TCP server in mio and registered multiple timeouts, but only the last registered timeout fires. Do I need a wrapper for my timeouts to combine them or are there any other ways to register multiple timeouts in mio v0.5?

1

There are 1 answers

0
kper On BEST ANSWER

I registered a tuple with an id

event_loop.timeout_ms((id, ServerTimeout::T1(timeout)), duration)

It didn't work, so I added id to ServerTimeout::T1 and called the timeout_ms method again:

event_loop.timeout_ms(ServerTimeout::T1(id, timeout), duration)