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

Fix permanent shutdowns (TLS & 1000 close code) #168

Merged
merged 7 commits into from
Jan 30, 2024

Conversation

ThePedroo
Copy link
Contributor

Notice

  • I understand the code that I have edited, and have the means
    to test it before making changes to Concord.

What?

This PR fixes an fatal issue that would block Concord from reconnecting to the gateway.

Why?

To allow bots to run for a long time, not being disconnecting without reconnecting.

How?

This includes various fixes about connections, both TLS and 1000 WS status code.

Testing?

It was tested by persons on Cogmaster's Discord and verified that the fix is working, properly reconnecting when disconnected abruptly.

lcsmuller and others added 5 commits January 10, 2024 20:19
Guarantees that both the easy and multi handle are recreated from scratch
Fixes previous commit, ensuring that it will initialize gateway before the usage of functions that request its structure, and to clean up only on the complete shutdown.
This commit fixes the issue that it wouldn't reconnect on 1000 close codes.
This commit fixes the issue that once a TLS notify was received, it wouldn't call on_close, ending up stuck in loop, not reconnecting.
This commit fixes an issue that the discord-loop loop wouldn't be breaken to reconnect, causing the bot to be stuck in the state of disconnected.

Co-authored-by: Lucas Müller <[email protected]>
@ThePedroo ThePedroo added the bug Something isn't working label Jan 30, 2024
@ThePedroo ThePedroo requested a review from lcsmuller January 30, 2024 02:02
core/websockets.c Outdated Show resolved Hide resolved
src/discord-gateway.c Outdated Show resolved Hide resolved
This commit updated the message that is printed to the terminal when a `ws_close` is called on a connection that has already ended.
This commit reverts a cleanup that is unnecessary as it's expected that `discord_cleanup` is called after `discord_run`.
@lcsmuller lcsmuller merged commit 0fa4373 into dev Jan 30, 2024
2 checks passed
@lcsmuller lcsmuller deleted the fix/not-reconnecting-tls branch January 30, 2024 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants