[ENet-discuss] enet_peer_disconnect_later deadlock

Martin Sherburn spacedude at konggame.co.uk
Fri Nov 30 14:04:40 PST 2007


I've just updated to v1.1 of enet and was happy to see the inclusion of 
the enet_peer_disconnect_later function. However I'm having a little 
trouble with it. Here is the situation in which deadlock seems to occur:

1) Master server listens for incoming connections
2) Client connects to master server
3) When the client receives the ENET_EVENT_TYPE_CONNECT event it sends a 
single packet to request a list of game servers
4) When the server receives this packet it replies with a list of 
servers, followed immediately by a call to enet_peer_disconnect_later
5) When the client receives the list of servers it also immediately 
attempts to terminate the connection with enet_peer_disconnect

In this situation it seems that the connection is not severed, I don't 
get a ENET_EVENT_TYPE_DISCONNECT event on either the server or the 
client. Actually its not really necessary for the server to call 
enet_peer_disconnect_later AND the client call enet_peer_disconnect on 
receipt of the packet. I just did it because I wanted to be doubly sure 
I wouldn't end up with a lingering connection. But it turns out that the 
connection IS severed if I used either enet_peer_disconnect_later on the 
server OR enet_peer_disconnect on the client, but NOT with both. :/

Any Ideas? Note that I'm using v1.1 and not the latest CVS release, has 
any known bug been fixed since then perhaps?

Thanks,

Martin.


More information about the ENet-discuss mailing list