Repository navigation
Conversation
tport_recv_stream_ws() reads one WebSocket frame per call and returns 1, and tport_recv_event() only loops again when the receive function returns more than 1. Over TLS, a second frame in the same TLS record is already in OpenSSL's buffer, so the socket is not readable and nothing wakes the poll for it. The frame is processed only when more data arrives. The plain TLS transport avoids this with "tls_pending() ? 2 : 1". Do the same for WSS with SSL_pending(). Seen as: a client sending ACK and the authenticated INVITE back to back after a 407. The INVITE sat unprocessed, so the first outbound call after idle hung until Timer B (408).
|
Thanks for looking into this — it is the same fix as #349 (opened 2026-10-27): |
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.
tport_recv_stream_ws()reads one WebSocket frame per call and returns 1.tport_recv_event()only loops again when the receive function returns more than 1. Over TLS, a second frame in the same TLS record is already decrypted in OpenSSL's buffer, so the socket is not readable and nothing wakes the poll for it. The frame is processed only when more data arrives on the connection.The plain TLS transport already handles this (
tls_pending(...) ? 2 : 1). This change does the same for WSS: return 2 whileSSL_pending()reports buffered data.Related: #349 is the same two-line change, found through a different symptom (100 Trying and 180 Ringing arriving in one record). I hit it independently, so I am adding a second trigger and measurements. Either PR is fine to merge; if #349 goes first, this one can be closed.
Symptom
A browser SIP client (JsSIP) behind a TLS-terminating nginx sends
ACKand the authenticatedINVITEback to back after a407. Both frames land in one TLS record. The INVITE is not processed until another message arrives, so the first outbound call after an idle period hangs; when nothing else arrives, Timer B ends it with408after 32 s.Test
A client writes two WebSocket frames over TLS and checks whether the second one gets a reply (stuck = no reply).
Environment: FreeSWITCH 1.10.13-dev. The numbers above were measured with sofia-sip built from
100d357plus this change, and then re-measured with a build of this exact commit (current master3cc785eplus this change) installed under the same FreeSWITCH: loopback 0/12 stuck for every gap, public internet 0/40 stuck for every gap.🤖 Generated with Claude Code