diff --git a/services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp b/services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp --- a/services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp +++ b/services/tunnelbroker/src/Service/TunnelbrokerServiceImpl.cpp @@ -185,6 +185,9 @@ grpc::StatusCode::PERMISSION_DENIED, "No such session found. SessionID: " + sessionID); } + database::DatabaseManager::getInstance().updateSessionItemIsOnline( + sessionID, true); + const std::string clientDeviceID = sessionItem->getDeviceID(); DeliveryBrokerMessage messageToDeliver; @@ -207,6 +210,8 @@ } if (!writer->Write(response)) { LOG(ERROR) << "gRPC: 'Get' writer error on sending data to the client"; + database::DatabaseManager::getInstance().updateSessionItemIsOnline( + sessionID, false); return false; } return true; @@ -254,6 +259,8 @@ DeliveryBroker::getInstance().deleteQueueIfEmpty(clientDeviceID); } ping_thread.join(); + database::DatabaseManager::getInstance().updateSessionItemIsOnline( + sessionID, false); } catch (std::runtime_error &e) { LOG(ERROR) << "gRPC: " << "Error while processing 'Get' request: " << e.what();