Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using a user specified time to fix disconnections on debug #272

Open
meemknight opened this issue Dec 29, 2024 · 1 comment
Open

Using a user specified time to fix disconnections on debug #272

meemknight opened this issue Dec 29, 2024 · 1 comment

Comments

@meemknight
Copy link

While breaking the code, it can easily happen for the user to timeout, would it be possible to add the feature that the user can supply the delta time to enet, so that it the program is ever paused at some point, it wouldn't disconnect the users?

@bjorn
Copy link

bjorn commented Jan 6, 2025

Did you try specifying appropriate values for enet_peer_timeout?

enet/peer.c

Lines 477 to 500 in 657eaf9

/** Sets the timeout parameters for a peer.
The timeout parameter control how and when a peer will timeout from a failure to acknowledge
reliable traffic. Timeout values use an exponential backoff mechanism, where if a reliable
packet is not acknowledge within some multiple of the average RTT plus a variance tolerance,
the timeout will be doubled until it reaches a set limit. If the timeout is thus at this
limit and reliable packets have been sent but not acknowledged within a certain minimum time
period, the peer will be disconnected. Alternatively, if reliable packets have been sent
but not acknowledged for a certain maximum time period, the peer will be disconnected regardless
of the current timeout limit value.
@param peer the peer to adjust
@param timeoutLimit the timeout limit; defaults to ENET_PEER_TIMEOUT_LIMIT if 0
@param timeoutMinimum the timeout minimum; defaults to ENET_PEER_TIMEOUT_MINIMUM if 0
@param timeoutMaximum the timeout maximum; defaults to ENET_PEER_TIMEOUT_MAXIMUM if 0
*/
void
enet_peer_timeout (ENetPeer * peer, enet_uint32 timeoutLimit, enet_uint32 timeoutMinimum, enet_uint32 timeoutMaximum)
{
peer -> timeoutLimit = timeoutLimit ? timeoutLimit : ENET_PEER_TIMEOUT_LIMIT;
peer -> timeoutMinimum = timeoutMinimum ? timeoutMinimum : ENET_PEER_TIMEOUT_MINIMUM;
peer -> timeoutMaximum = timeoutMaximum ? timeoutMaximum : ENET_PEER_TIMEOUT_MAXIMUM;
}

enet/include/enet/enet.h

Lines 224 to 226 in 657eaf9

ENET_PEER_TIMEOUT_LIMIT = 32,
ENET_PEER_TIMEOUT_MINIMUM = 5000,
ENET_PEER_TIMEOUT_MAXIMUM = 30000,

I personally don't fully understand what unit these values are in, but it seems like you should be able to set a very high maximum timeout to avoid peers disconnecting during debugging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants