Skip to content

Commit

Permalink
Merge pull request #654 from private-forks/fix_close_race
Browse files Browse the repository at this point in the history
[FIXED] Missing connection status check causing unexpected delay during connection close
  • Loading branch information
kozlovic committed May 15, 2023
2 parents 7f6910e + 5bc5156 commit 8c02dcc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/conn.c
Expand Up @@ -1581,15 +1581,15 @@ _doReconnect(void *arg)
natsConn_Unlock(nc);
sleepTime = crd(nc, wlf, crdClosure);
natsConn_Lock(nc);
if (natsConn_isClosed(nc))
break;
}
else
{
sleepTime = nc->opts->reconnectWait;
if (jitter > 0)
sleepTime += rand() % jitter;
}
if (natsConn_isClosed(nc))
break;
natsCondition_TimedWait(nc->reconnectCond, nc->mu, sleepTime);
}
else
Expand Down

0 comments on commit 8c02dcc

Please sign in to comment.