You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor SSL socket send path and improve test coverage
Replace the ring-buffer-based send mechanism (send_buf + single
send_buf_pending slot) with per-op pool-allocated ssl_send_op_t
using embedded encrypted data buffer, free list with configurable
cap, and true memory release on discard. This eliminates the
PJ_ENOMEM crash during renegotiation reported in #4878.
Key changes:
- New ssl_send_op_t with per-op pool for true memory release
- ssl_do_handshake_and_flush() wrapper unifying error handling
across all 5 SSL backends (OpenSSL, GnuTLS, mbedTLS, Schannel,
Darwin)
- Fix flush_delayed_send: pass correct app_key, handle PJ_EPENDING
to prevent double-send, invoke callback on synchronous success
- Fix ssock_on_data_sent: check app_key (not send_key) for
handshake/shutdown detection (was dead code before)
- Fix ssock_on_connect_complete: return via on_handshake_complete
instead of bare PJ_ENOMEM from pj_bool_t function
- Rename circ_buf_output/input to ssl_write_buf/ssl_read_buf for
clarity (not always circular — OpenSSL uses memory BIO)
- Add "Caller must hold write_mutex" documentation to ssl_write()
in all 6 backends
Test improvements:
- send_load_test: 200 rapid sends with async callback verification
- large_msg_test: 64KB message (multi-TLS-record) echo verification
- close_pending_test: close socket with pending sends (no crash)
- bidir_test: bidirectional simultaneous send load
- mt_send_load_test: 3 worker threads + 3 concurrent clients
CI: add ioq-no-fast-track job (PJ_IOQUEUE_FAST_TRACK=0 + ASan)
to force async send path in activesock and ssl_sock tests.
Co-Authored-By: Claude Code
0 commit comments