Skip to content

Commit

Permalink
Merge pull request #2 from biot2/biot2-patch-2
Browse files Browse the repository at this point in the history
Update conn.c
  • Loading branch information
biot2 authored Nov 11, 2023
2 parents ea2cb00 + 7607b24 commit cf7a01e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ _processInfo(natsConnection *nc, char *info, int len)
IFOK(s, nats_JSONGetInt(json, "port", &(nc->info.port)));
IFOK(s, nats_JSONGetBool(json, "auth_required", &(nc->info.authRequired)));
IFOK(s, nats_JSONGetBool(json, "tls_required", &(nc->info.tlsRequired)));
IFOK(s, nats_JSONGetBool(json, "tls_available", &(nc->info.tlsAvailable)));
IFOK(s, nats_JSONGetLong(json, "max_payload", &(nc->info.maxPayload)));
IFOK(s, nats_JSONGetArrayStr(json, "connect_urls",
&(nc->info.connectURLs),
Expand Down Expand Up @@ -771,7 +772,7 @@ _checkForSecure(natsConnection *nc)
natsStatus s = NATS_OK;

// Check for mismatch in setups
if (nc->opts->secure && !nc->info.tlsRequired)
if (nc->opts->secure && !nc->info.tlsRequired && !nc->info.tlsAvailable)
s = nats_setDefaultError(NATS_SECURE_CONNECTION_WANTED);
else if (nc->info.tlsRequired && !nc->opts->secure)
{
Expand Down

0 comments on commit cf7a01e

Please sign in to comment.