Skip to content

nta/s2sip test: fix dead tcp/tls transport fallback (duplicated if condition)#329

Open
garacil wants to merge 1 commit into
freeswitch:masterfrom
garacil:fix-99-tport-fallback
Open

nta/s2sip test: fix dead tcp/tls transport fallback (duplicated if condition)#329
garacil wants to merge 1 commit into
freeswitch:masterfrom
garacil:fix-99-tport-fallback

Conversation

@garacil

@garacil garacil commented Jul 5, 2026

Copy link
Copy Markdown

The transport-selection fallback in s2sip.c used an else if chain that re-tests the same condition:

if (tport == NULL)      tport = s2sip->udp.tport;
else if (tport == NULL) tport = s2sip->tcp.tport;
else if (tport == NULL) tport = s2sip->tls.tport;

Once the first if runs, the else if branches are unreachable (an else only runs when tport was non-NULL, and then re-checks == NULL, which is false), so the tcp/tls fallbacks were dead code. This switches to sequential if statements, matching the fallthrough style already used for the sut/tls selection a few lines above.

Fixes #99.

The transport-selection fallback used an else-if chain that re-tests the
same condition:

  if (tport == NULL)      tport = udp;
  else if (tport == NULL) tport = tcp;
  else if (tport == NULL) tport = tls;

Once the first if runs, the else-if branches are unreachable (an else
only runs when tport was non-NULL, then re-checks == NULL, which is
false), so the tcp/tls fallbacks were dead code. Use sequential if
statements, matching the fallthrough style already used for the
sut/tls selection a few lines above.

Fixes freeswitch#99.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

s2sip.c:480:18: warning: duplicated 'if' condition

1 participant