[ENet-discuss] ENet handling of EAGAIN and EINTR

James Bellinger james at illusorystudios.com
Mon Apr 22 21:25:15 PDT 2013


Hello,

Today I was trying to get ENet running on Linux using Mono and C#, and 
discovered that ENet does not correctly retry on EAGAIN and EINTR.
Mono uses signals to start garbage collections, so not handling these 
causes spurious failures of enet_host_service and other methods using 
sockets.
I can write a patch for this no problem, but there's one detail I'd like 
input on first.

enet_socket_wait is sent a timeout. If I retry poll/select, the timeout 
will be wrong. So, my thought is, introduce a new return value -2 on 
enet_socket_wait to indicate 'error, but retry'. Functions using the 
normal ENet convention of < 0 for error will behave as they did before. 
enet_host_service can then be coded to properly retry with correct 
timeout. Still, this is an (minor) API change so I thought I'd ask 
before coding it all up.

All other socket functions can just retry on their own, since there's no 
timing aspect. This'd all affect unix.c mostly and protocol.c slightly.

Thanks

James



More information about the ENet-discuss mailing list