Skip to content

Commit

Permalink
PR feedback: use natsSock_Shutdown in natsConnection_Reconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
levb committed Jul 13, 2024
1 parent b1a6e9c commit 7723d1a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -3435,7 +3435,7 @@ natsConnection_Reconnect(natsConnection *nc)
return nats_setDefaultError(NATS_CONNECTION_CLOSED);
}

natsSock_Close(nc->sockCtx.fd);
natsSock_Shutdown(nc->sockCtx.fd);

natsConn_Unlock(nc);
return NATS_OK;
Expand Down
10 changes: 1 addition & 9 deletions test/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -20248,15 +20248,6 @@ test_ForcedReconnect(void)
natsMsg *msg = NULL;
natsPid pid = NATS_INVALID_PID;

#ifdef __SANITIZE_THREAD__
// threadSanitizer complains that we close the fd when a read may be in
// progress. Since it appears to work as desired, skipping the test.

test("Skipping test_ForcedReconnect test because it does not work with thread sanitizer\n");
testCond(true);
return;
#endif

s = _createDefaultThreadArgsForCbTests(&arg);
if (s != NATS_OK)
FAIL("unable to setup test");
Expand All @@ -20266,6 +20257,7 @@ test_ForcedReconnect(void)
CHECK_SERVER_STARTED(pid);
IFOK(s, natsOptions_Create(&opts));
IFOK(s, natsOptions_SetReconnectedCB(opts, _reconnectedCb, &arg));
IFOK(s, natsOptions_SetReconnectWait(opts, 100));
IFOK(s, natsConnection_Connect(&nc, opts));
IFOK(s, natsConnection_SubscribeSync(&sub, nc, "foo"));
testCond(s == NATS_OK);
Expand Down

0 comments on commit 7723d1a

Please sign in to comment.