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

Disconnect websocket also when it is not connected. #418

Merged
merged 3 commits into from
Feb 23, 2024

Conversation

maaikez
Copy link
Contributor

@maaikez maaikez commented Jan 25, 2024

Add some more checks. Cancel timer in websocket destructor.

this->ws_client.close(this->handle, websocketpp::close::status::normal, "");
} catch (std::exception& e) {
EVLOG_error << "Error on plain close: " << e.what();
if (!this->shutting_down) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if WebsocketBase::disconnect is called just after this line? Will the code after this line still run and is that a problem?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean to add it there? Or in the 'else'? I do not totally understand what you mean.

lib/ocpp/common/websocket/websocket_base.cpp Show resolved Hide resolved
Maaike Zijderveld and others added 3 commits February 22, 2024 11:24
…cks. Cancel timer in websocket destructor.

Signed-off-by: Maaike Zijderveld <[email protected]>
Signed-off-by: Maaike <[email protected]>
…ave a connection

Signed-off-by: Maaike Zijderveld <[email protected]>
Signed-off-by: Maaike <[email protected]>
Signed-off-by: Maaike <[email protected]>
@hikinggrass hikinggrass merged commit 72cbc5a into main Feb 23, 2024
4 checks passed
@hikinggrass hikinggrass deleted the mz-websocket-connection-stop branch February 23, 2024 13:22
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.

websocket connection is not properly stopped when the websocket is not connected
3 participants