Skip to content

Commit

Permalink
guard against @connected falling below zero
Browse files Browse the repository at this point in the history
Signed-off-by: Jake Smith <[email protected]>
  • Loading branch information
jakesmith committed Jun 20, 2024
1 parent 59ff9d2 commit c964156
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions common/workunit/wujobq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1128,9 +1128,11 @@ class CJobQueue: public CJobQueueBase, implements IJobQueue
ForEachQueue(qd)
{
IPropertyTree *croot = queryClientRootSession(*qd);
unsigned newConnectedCount = croot->getPropInt64("@connected",0)-1;
if (newConnectedCount)
croot->setPropInt64("@connected", newConnectedCount);
unsigned connectedCount = croot->getPropInt64("@connected");
if (connectedCount) // should never be 0, but guard JIC
connectedCount--;
if (connectedCount)
croot->setPropInt64("@connected", connectedCount);
else
qd->root->removeTree(croot);
}
Expand Down

0 comments on commit c964156

Please sign in to comment.