Closed illej closed 3 years ago
It sounds like you are no longer properly servicing the host and things time out because you haven't resumed doing so before the timeout period.
On Thu, Jul 22, 2021 at 7:18 AM Elliot Ayrey @.***> wrote:
Hey there,
I've been making a basic chat application using the code snippets provided in the tutorial and it mostly works great, but I've come across a strange problem:
When I have multiple clients connected to a server, if one of the clients initiates a disconnect, then other clients will be disconnected by the server shortly after.
I have narrowed it down to this code block that is issuing the disconnect.
static int enet_protocol_check_timeouts (ENetHost host, ENetPeer peer, ENetEvent * event) { ...
if (peer -> earliestTimeout != 0 && (ENET_TIME_DIFFERENCE (host -> serviceTime, peer -> earliestTimeout) >= peer -> timeoutMaximum || (outgoingCommand -> roundTripTimeout >= outgoingCommand -> roundTripTimeoutLimit && ENET_TIME_DIFFERENCE (host -> serviceTime, peer -> earliestTimeout) >= peer -> timeoutMinimum))) { enet_protocol_notify_disconnect (host, peer, event); return 1; }
The odd thing is this only happens to windows clients. Specifically, if I have 4 clients connected to a server, 2 on windows and 2 on linux, if one of the windows clients disconnects, all other windows clients will be forcefully disconnected by the server - the linux clients are unaffected.
Just wondering if anyone knows what could be the cause of this? I plan on digging a bit deeper at some point but figured I would report it in case anyone else was encountering something similar.
Cheers!
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lsalzman/enet/issues/165, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALDVUKJNEITMOYBICNWMP3TY747NANCNFSM5AZZL2DA .
I apologise - you were right!
My chat clients were setup to read stdio in the main thread and shuttle messages to another thread that was servicing ENet. However, on windows I was using a named event object to signal the ENet thread, not knowing that if multiple separate processes all wait on a named event object of the same name they will all receive the signal, leading to the ENet threads in all windows clients halting and therefore getting disconnected.. whoops!
Sorry for wasting your time, and thank you for your response.
Great library by the way!
Hey there,
I've been making a basic chat application using the code snippets provided in the tutorial and it mostly works great, but I've come across a strange problem:
When I have multiple clients connected to a server, if one of the clients initiates a disconnect, then other clients will be disconnected by the server shortly after.
I have narrowed it down to this code block that is issuing the disconnect.
The odd thing is this only happens to windows clients. Specifically, if I have 4 clients connected to a server, 2 on windows and 2 on linux, if one of the windows clients disconnects, all other windows clients will be forcefully disconnected by the server - the linux clients are unaffected.
Just wondering if anyone knows what could be the cause of this? I plan on digging a bit deeper at some point but figured I would report it in case anyone else was encountering something similar.
Cheers!