tport: send responses on the incoming connection when reuse-connections is off#330
Open
garacil wants to merge 1 commit into
Open
tport: send responses on the incoming connection when reuse-connections is off#330garacil wants to merge 1 commit into
garacil wants to merge 1 commit into
Conversation
With reuse-connections disabled (tp_reusable == 0), tport_tsend() computed reuse = 0 and then fresh = fresh || !reuse, forcing a fresh connection even when the caller handed it the exact live secondary transport to send on - e.g. nta sending a response on the connection the request arrived on. The stack then tried to open a new connection to the peer's ephemeral source port, which fails, so the response was never sent (freeswitch#309). tp_reusable governs whether a connection may be reused for other destinations; it must not prevent sending on the exact connection the caller passed in. Distinguish an inherited tp_reusable == 0 from an explicit per-send TPTAG_REUSE(0): only the latter (or a self that is not a live secondary) forces a fresh connection. Add tport_is_live_secondary() (clear-to-send without the tp_reusable requirement) and use it for the exact-secondary send path. The reuse search (tport_by_name/by_addrinfo) and the client user-tport guard (nta.c) still require tp_reusable, so outgoing connection-reuse policy is unchanged. Fixes freeswitch#309.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With
reuse-connectionsdisabled (tp_reusable == 0),tport_tsend()computedreuse = 0and thenfresh = fresh || !reuse, forcing a fresh connection even when the caller handed it the exact live secondary transport to send on — for example nta sending a response on the very connection the request arrived on (tport_tsend(irq->irq_tport, ...)). The stack then tried to open a new connection to the peer's ephemeral source port, which fails, so the response was never sent.tp_reusableshould govern whether a connection may be reused for other destinations; it must not prevent sending on the exact connection the caller passed in.This distinguishes an inherited
tp_reusable == 0from an explicit per-sendTPTAG_REUSE(0):tport_is_live_secondary()— the clear-to-send predicate without thetp_reusablerequirement (registered, not closed, not send-closed);reuse == 0no longer forcesfreshwhenselfis the exact live secondary; an explicitTPTAG_REUSE(0)(or aselfthat is not a live secondary) still does, andTPTAG_FRESHis unchanged;tport_is_live_secondary(self).Outgoing connection-reuse policy is preserved: the reuse search (
tport_by_name/tport_by_addrinfo) still skips non-reusable connections, and a caller-provided outgoing tport is still guarded bytport_is_clear_to_send()in nta. No ABI/API change.Fixes #309.