[ENet-discuss] ENet Timeout

Tibor Klajnscek fury at xubl.com
Wed Feb 2 06:18:43 PST 2005


Hi everyone!

Please take this with a grain of salt, as I might have missed something 
in my analysis :)

After looking at the code, I see that ENet's timeout depends on the 
connection quality of the peer.
I have ENET_PEER_TIMEOUT_LIMIT set to 32 (default from CVS) which means 
that ENet
will resend each packet 6 times, each time with a doubled TTL like this:

We're sending to a peer with 30ms latency. I've ommited latency variance 
from the calculation.
1. Packet sent: TTL 30 , TTL Limit is 32 * 30 = 960
2. Packet timed out
3. Packet sent: TTL 60
4. Packet timed out
5. Packet sent: TTL 120
6. Packet timed out
7. Packet sent: TTL 240
8. Packet timed out
9. Packet sent: TTL 480
10. Packet timed out
11. Packet sent: TTL 960
12. Disconnect peer

Total time: 1890 ms

So now I'm wondering.. wouldn't it be better if the packets were sent 
out in regular intervals?
An also.. from a games point of view.. it would be better if there was a 
fixed value for timeout.
It ensures better predictability... with the current system, a peer with 
a very good connection would
get dropped very quickly if his connection stalled for about a second or 
so, but a peer with 300ms ping
would take almost 19 seconds...

Sure I can go and implement a fixed timer, but I'm just wondering about 
the reasons behind this design
decision. Could anyone with more experience please elaborate more on 
this subject?


More information about the ENet-discuss mailing list