Skip to content

Commit

Permalink
Cleanup in dtor/start
Browse files Browse the repository at this point in the history
Signed-off-by: AssemblyJohn <[email protected]>
  • Loading branch information
AssemblyJohn committed Dec 5, 2024
1 parent 70b6cad commit 2c9d45e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/ocpp/common/websocket/websocket_libwebsockets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,12 @@ WebsocketLibwebsockets::~WebsocketLibwebsockets() {
}
}

// Stop the dangling timer
{
std::lock_guard<std::mutex> lk(this->reconnect_mutex);
this->reconnect_timer_tpm.stop();
}

if (this->m_is_connected || is_trying_to_connect_internal()) {
this->close_internal(WebsocketCloseReason::Normal, "websocket destructor");
}
Expand Down Expand Up @@ -939,6 +945,8 @@ bool WebsocketLibwebsockets::start_connecting() {
this->reconnect_timer_tpm.stop();
}

this->connection_attempts = 1; // reset connection attempts

// This should always be running, start it only once
if (this->deferred_callback_thread == nullptr) {
this->deferred_callback_thread =
Expand Down

0 comments on commit 2c9d45e

Please sign in to comment.