You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This should fix the old shard is not being there if something in network stack has failed during the reconnection stage. Additionally I removed what looks to be a pair of duplicate parameters with unnecessary std::string copying in the reconnect for client constructor, since old is being deleted long after new discord_client being constructed, it shouldn't be a problem.
Here's traces from my reconnect test:
[2026-07-07 18:06:44] TRACE: Shard 0 not ready to reconnect yet.
[2026-07-07 18:06:44] TRACE: Shard 0 not ready to reconnect yet.
[2026-07-07 18:06:44] TRACE: Shard 0 not ready to reconnect yet.
[2026-07-07 18:06:44] TRACE: Shard 0 not ready to reconnect yet.
[2026-07-07 18:06:45] INFO: Reconnecting shard 0
[2026-07-07 18:06:45] TRACE: Attempting resume...
[2026-07-07 18:06:45] TRACE: Running new connection...
[2026-07-07 18:06:45] TRACE: Deleting old connection...
[2026-07-07 18:06:45] TRACE: Installing new connection...
It's not the actual DNS failure test because it's kinda hard to catch the thing in action, but at least I proved that reconnection mechanism is not broken, my bot still keeps replying to messages after the reconnection.
Code change checklist
I have ensured that all methods and functions are fully documented using doxygen style comments.
Just caught that exception again and realised I forgot to move an old object back to shards list in case of said exception. It did the full recreation so technically it worked but now it should be able to resume, too.
Actually now that I think about it more and looking at discordclient.cpp, the old shard can be sabotaged by new constructor since it's moving that connecting_voice_channels map from old object to a new one. We should either come up with mechanism that brings those channels back in case they were already moved and got their ownership swapped or leave it as is and just do full reconnection on exception
Actually now that I think about it more and looking at discordclient.cpp, the old shard can be sabotaged by new constructor since it's moving that connecting_voice_channels map from old object to a new one. We should either come up with mechanism that brings those channels back in case they were already moved and got their ownership swapped or leave it as is and just do full reconnection on exception
Actually now that I think about it more and looking at discordclient.cpp, the old shard can be sabotaged by new constructor since it's moving that connecting_voice_channels map from old object to a new one. We should either come up with mechanism that brings those channels back in case they were already moved and got their ownership swapped or leave it as is and just do full reconnection on exception
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
codeImprovements or additions to code.documentationImprovements or additions to documentation
3 participants
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.
This should fix the old shard is not being there if something in network stack has failed during the reconnection stage. Additionally I removed what looks to be a pair of duplicate parameters with unnecessary
std::stringcopying in the reconnect for client constructor, sinceoldis being deleted long after newdiscord_clientbeing constructed, it shouldn't be a problem.Here's traces from my reconnect test:
It's not the actual DNS failure test because it's kinda hard to catch the thing in action, but at least I proved that reconnection mechanism is not broken, my bot still keeps replying to messages after the reconnection.
Code change checklist
Documentation change checklist
doxygen, and testing examples).