diff --git a/lib/ocpp/common/websocket/websocket_libwebsockets.cpp b/lib/ocpp/common/websocket/websocket_libwebsockets.cpp index dadc725bd..9a49d9d26 100644 --- a/lib/ocpp/common/websocket/websocket_libwebsockets.cpp +++ b/lib/ocpp/common/websocket/websocket_libwebsockets.cpp @@ -351,6 +351,12 @@ WebsocketLibwebsockets::~WebsocketLibwebsockets() { } } + // Stop the dangling timer + { + std::lock_guard 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"); } @@ -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 =