diff --git a/src/rpc_connection.cpp b/src/rpc_connection.cpp index 8bfef98..b10269b 100644 --- a/src/rpc_connection.cpp +++ b/src/rpc_connection.cpp @@ -69,7 +69,7 @@ void RpcConnection::Open() void RpcConnection::Close() { - if (onDisconnect && state == State::Connected) { + if (onDisconnect && (state == State::Connected || state == State::SentHandshake)) { onDisconnect(lastErrorCode, lastErrorMessage); } connection->Close();