Please sign in to comment.
Overhaul all handling of losing connection to improve AutoReconnect.
- The bot now has three settings for AutoReconnect: [Features] ReconnectType=0, 1, or 2 [default 2] ReconnectDelay=SECONDS [default 300 -- 5 minutes] ReconnectDelayMax=SECONDS [default 3600 -- 1 hour] When Type=0, no auto-reconnection is done. When Type=1, the bot waits (ReconnectDelay) seconds any time it loses connection for a "non-client reason". When Type=2, the bot waits (ReconnectDelay * NUMBER OF TRIES) seconds any time it loses connection for a "non-client reason". The wait cannot exceed ReconnectDelayMax. - In any case, AutoReconnect will first try a "0-wait" reconnect if a connection was previously active (in most cases). That way, network errors on the client end can be quickly overcome. - Since ReconnectDelay is now in seconds, previous settings will probably be unusual under this system. Fortunately, 1000 seconds (old ReconnectDelay default) is 16 minutes 40 seconds and not too different magnitude from 300 seconds (5 minutes). New installations will be set to 300 seconds. AutoReconnect will always wait at least 1 second. - Changed the way DoDisconnect() works across the bot so that it is the only place resources are cleaned up, and it is called consistently. DoDisconnect() now has a notion of "client-initiated" disconnects and the opposite, "non-client reason", can then be followed up with a call to the AutoReconnect process. - Any disconnect that is unrecoverable, such as version check errors (not done by BNLS with BNLS finder active), will go through AutoReconnect now. - The default DoDisconnect() is unrecoverable and most of the calls to it are unchanged. - BNLS closing connection prematurely and a different case of BNLS version check failing now go through BNLS finder (but not AutoReconnect). - MCP, BNCS, and BNLS now handle losing connection from the proxy handshake better and should try AutoReconnect. - The bot now handles "[BNCS] Disconnected." without a socket error as a reason to try AutoReconnect (possible IP ban). - Getting a "CD-Key in use" error with the owner equal to the one the bot should have sent results in the bot trying AutoReconnect. This is anti-ghosting support. No "0-wait" reconnect will occur. - Changed and standardized the appearance of connection errors. Since many of the specific features of the old error messages have changed or become obsolete, most custom errors have been removed. (IP bans now result in a connection close with no socket error; there are no server IPs listed under gateway addresses; etc.) Instead, with the more functional AutoReconnect system, it should be possible to return online with varying client, network, and server issues of any kind. - AutoReconnect displays the time until reconnect with the same interval display function as uptime, meaning that it will be in a sane human-readable format. - Refactoring: Removed clsErrorHandler, CloseAllConnections(), and some other functionality that is no longer used. HandleBnlsError() still calls into the BNLS finder before trying AutoReconnect [to the same server]. The ReconnectTimer timer is now like the ExReconnectTimer and is a 1000-millisecond timer using a Long "ticks" counter until the reconnect, supporting longer time frames. There is also only one such timer in the bot, simplifying the code.
- Loading branch information...
Showing with 388 additions and 606 deletions.
- +8 −9 trunk/clsBotVars.cls
- +30 −3 trunk/clsConfig.cls
- +0 −173 trunk/clsErrorHandler.cls
- +319 −351 trunk/frmChat.frm
- +1 −1 trunk/modBNCS.bas
- +1 −2 trunk/modBNLS.bas
- +1 −1 trunk/modCommandsChat.bas
- +14 −7 trunk/modEvents.bas
- +5 −2 trunk/modGlobals.bas
- +0 −20 trunk/modOtherCode.bas
- +9 −37 trunk/modTimerProcs.bas
Oops, something went wrong.
Oops, something went wrong.