Skip to content

fix reconnection in boost::asio code#548

Merged
cryptochassis merged 1 commit intocrypto-chassis:developfrom
fedeitc:asio-reconnet-fix
Sep 23, 2025
Merged

fix reconnection in boost::asio code#548
cryptochassis merged 1 commit intocrypto-chassis:developfrom
fedeitc:asio-reconnet-fix

Conversation

@fedeitc
Copy link
Copy Markdown
Collaborator

@fedeitc fedeitc commented Sep 22, 2025

No description provided.

} else if (kind == boost::beast::websocket::frame_type::pong) {
this->onPong(wsConnectionPtr, payload);
} else if (kind == boost::beast::websocket::frame_type::close) {
this->onClose(wsConnectionPtr, {});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fedeitc I think we should leave this line there, should we?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it should be removed.
The control_callback is always triggered during a read operation, so there will always be a subsequent call to onReadWs after the control_callback, with the error_code set.
Invoking onClose at this point would result in a double reconnection attempt, the first from onClose and then again from onFail via onReadWs.
https://www.boost.org/doc/libs/1_87_0/libs/beast/doc/html/beast/ref/boost__beast__websocket__stream/async_read.html

@cryptochassis cryptochassis merged commit ba4fe90 into crypto-chassis:develop Sep 23, 2025
2 checks passed
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

Successfully merging this pull request may close these issues.

2 participants