Fix: Block auto reconnect if connection duration less than 5 seconds. #7952
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Brief overview of PR changes/additions
Use cTelnet's mConnectionTimer to track whether the client was connected to the server for under 5 seconds. If so, auto-reconnect is blocked.
Also the disconnect message is modified to clarify that the disconnection reason was for "Connection/login attempt rejected by server".
Motivation for adding to Mudlet
Hopefully an approximate fix for the issues surrounding failed auto-logins / Mudlet spamming servers with automatic reconnects.
Other info (issues closed, discussion etc)
Tested to prevent login-loops for mistaken passwords, but succeeds in reconnecting for disconnection events during a normal playing session. Also this doesn't prevent echoing connection errors via e.g. failed SSL authentication.
I consider this an elegant solution for differentiating between servers rejecting a client's connection attempt and disconnecting while playing, but I would understand if Mudlet would prefer to more explicitly track whether a login attempt failed etc.
(Potentially) Fixes: #7584