Skip to content

Commit

Permalink
Little fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JackyWoo committed Jan 2, 2024
1 parent cce1ea2 commit 3499611
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Service/ConnectionHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,8 @@ void ConnectionHandler::sendSessionResponseToClient(const Coordination::ZooKeepe
if (!success)
{
LOG_ERROR(log, "Failed to establish session, close connection.");
keeper_dispatcher->unregisterUserResponseCallBackWithoutLock(session_id);
if (session_id)
keeper_dispatcher->unregisterUserResponseCallBackWithoutLock(session_id);
if (!handshake_done)
keeper_dispatcher->unRegisterSessionResponseCallbackWithoutLock(internal_id);
else
Expand Down
2 changes: 2 additions & 0 deletions src/Service/KeeperDispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@ void KeeperDispatcher::unRegisterSessionResponseCallbackWithoutLock(int64_t id)

void KeeperDispatcher::registerUserResponseCallBack(int64_t session_id, ZooKeeperResponseCallback callback, bool is_reconnected)
{
if (session_id != 0)
throw Exception(ErrorCodes::LOGICAL_ERROR, "Session id cannot be 0");
std::lock_guard lock(user_response_callbacks_mutex);
registerUserResponseCallBackWithoutLock(session_id, callback, is_reconnected);
}
Expand Down

0 comments on commit 3499611

Please sign in to comment.