Skip to content

Commit

Permalink
Merge pull request #3332 from bontibon/issue-3299
Browse files Browse the repository at this point in the history
ignore connecting users in qhUsers hash in gRPC implementation
  • Loading branch information
Tim Cooper committed Feb 8, 2018
2 parents aa90739 + 23b171c commit 765f780
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/murmur/MurmurGRPCImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ void MurmurRPCImpl::contextAction(const ::User *user, const QString &action, uns
// exception.
::ServerUser *MustUser(const Server *server, unsigned int session) {
auto user = server->qhUsers.value(session);
if (!user) {
if (!user || user->sState != ServerUser::Authenticated) {
throw ::grpc::Status(::grpc::NOT_FOUND, "invalid user");
}
return user;
Expand Down Expand Up @@ -1285,6 +1285,9 @@ void V1_ContextActionRemove::impl(bool) {
} else {
// Remove context action from all users
foreach(::ServerUser *user, server->qhUsers) {
if (user->sState != ServerUser::Authenticated) {
continue;
}
rpc->removeActiveContextAction(server, user, action);
server->sendMessage(user, mpcam);
}
Expand Down Expand Up @@ -1578,6 +1581,9 @@ void V1_UserQuery::impl(bool) {
list.mutable_server()->set_id(server->iServerNum);

foreach(const ::ServerUser *user, server->qhUsers) {
if (user->sState != ServerUser::Authenticated) {
continue;
}
auto rpcUser = list.add_users();
ToRPC(server, user, rpcUser);
}
Expand All @@ -1600,6 +1606,9 @@ void V1_UserGet::impl(bool) {
// Lookup user by name
QString qsName = u8(request.name());
foreach(const ::ServerUser *user, server->qhUsers) {
if (user->sState != ServerUser::Authenticated) {
continue;
}
if (user->qsName == qsName) {
ToRPC(server, user, &rpcUser);
end(rpcUser);
Expand Down

0 comments on commit 765f780

Please sign in to comment.