Skip to content

Commit

Permalink
Lock s_critsect in AbandonConn to be safe
Browse files Browse the repository at this point in the history
Not completely sure if this is actually necessary, but all other code
that uses the abandoned and cancelId fields also holds s_critsect.
Currently, all callers of AbandonConn already have s_critsect locked,
but this is clearer and safer in case the calling code changes.

Co-authored-by: Adam Johnson <[email protected]>
  • Loading branch information
dgelessus and Hoikas committed Sep 19, 2023
1 parent bd6b2b2 commit f931654
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,7 @@ static CliAuConn * GetConnIncRef (const char tag[]) {

//============================================================================
static void AbandonConn(CliAuConn* conn) {
hsLockGuard(s_critsect);
conn->abandoned = true;

conn->StopAutoReconnect();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ static CliFileConn * GetConnIncRef (const char tag[]) {

//============================================================================
static void AbandonConn(CliFileConn* conn) {
hsLockGuard(s_critsect);
conn->abandoned = true;

if (conn->AutoReconnectEnabled())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ static CliGmConn * GetConnIncRef (const char tag[]) {

//============================================================================
static void AbandonConn(CliGmConn* conn) {
hsLockGuard(s_critsect);
conn->abandoned = true;
if (conn->cancelId) {
AsyncSocketConnectCancel(conn->cancelId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ static CliGkConn * GetConnIncRef (const char tag[]) {

//============================================================================
static void AbandonConn(CliGkConn* conn) {
hsLockGuard(s_critsect);
conn->abandoned = true;

conn->StopAutoReconnect();
Expand Down

0 comments on commit f931654

Please sign in to comment.