I've investigated this further and is seems like the problem occurs when the server side gets two connect commands, ENET_PROTOCOL_COMMAND_CONNECT from the same client without any disconnect in between. The ENet host at the server will in that case get two peers with the exact same address and port. After a while one of them will get a timeout, and that timeout is what triggers the strange ENET_EVENT_TYPE_DISCONNECT. Our application code at the server side interprets this as a connection loss, but on the client side it is still connected since we have that other peer still up and running and responding.
I've solved this by letting the application code on the server do a reset on the current peer when a new is received with the same address and port. Best regards, Kristin Nielsen Software Developer LHD Applications Rocktec Division Atlas Copco Rock Drills AB Address: Klerkgatan 21 701 91 Örebro Sweden Phone: +46 019 768 25 85 E-mail: [email protected] Visit us at: Follow us at: http://www.atlascopco.com Facebook / Twitter / LinkedIn / YouTube Committed to sustainable productivity From: [email protected] To: [email protected] Date: 2015-06-18 16:06 Subject: [ENet-discuss] Inconsistent connection status between hosts in bad network conditions Sent by: "ENet-discuss" <[email protected]> I've been investigating a system with two Enet hosts under bad network conditions, and noticed a spurious disconnect at the server. I've used Enet v.1.3.13 and for simulating bad network I've used netem with configuration "delay 100ms 100ms 5% loss random 45% corrupt 35%" which means a delay of all packets of 100ms a random loss of 45% for all packets and 35% of all packets are corrupt. At first, the network is good and both client and server connects to each other, Enet reports ENET_EVENT_TYPE_CONNECT. Then I apply the bad network and both the client and the server disconnects, Enet reports ENET_EVENT_TYPE_DISCONNECT on both client and server. When the bad network conditions are restored, at first, everything seems to work fine. Enet reports ENET_EVENT_TYPE_CONNECT for both client and server. But then, after some second, I will get a spurios ENET_EVENT_TYPE_DISCONNECT on the server side only. The client still thinks everything is up and running. And I'm stuck in a state that I can only get out from by restarting one of the applications(either the server or the client doesn't matter) This happens almost everytime. I have also noted that if I apply really bad network, for example a random loss of 95% of all packets, and the restore. Then, I havn't seen this strange disconnect. Best regards, Kristin Nielsen Software Developer LHD Applications Rocktec Division Atlas Copco Rock Drills AB Address: Klerkgatan 21 701 91 Örebro Sweden Phone: +46 019 768 25 85 E-mail: [email protected] Visit us at: Follow us at: http://www.atlascopco.com Facebook / Twitter / LinkedIn / YouTube Committed to sustainable productivity _______________________________________________ ENet-discuss mailing list [email protected] http://lists.cubik.org/mailman/listinfo/enet-discuss
_______________________________________________ ENet-discuss mailing list [email protected] http://lists.cubik.org/mailman/listinfo/enet-discuss
