Skip to content

ssl: update rdoc for SSLSocket#pending and #wait_readable - #1119

Open
rhenium wants to merge 1 commit into
ruby:masterfrom
rhenium:ky/ssl-wait-readable-rdoc
Open

rhenium wants to merge 1 commit into
ruby:masterfrom
rhenium:ky/ssl-wait-readable-rdoc

Conversation

@rhenium

@rhenium rhenium commented Oct 2, 2026

Copy link
Copy Markdown
Member

Clarify how they (do not) interact with read buffers.

SSLSocket#pending corresponds to SSL_pending(). It reports data that is already processed and is immediately available to read from the OpenSSL library's internal buffer.

SSLSocket#wait_readable does not check for buffered data, either in the OpenSSL library or in OpenSSL::Buffering, so it may block even when data is already available to read.

This is different from IO#wait_readable. I considered changing SSLSocket#wait_readable to check these buffers, but rejected it because it is also used when the caller specifically needs to wait for new records from the peer, particularly after SSLSocket#write_nonblock returns :wait_readable.

Clarify how they (do not) interact with read buffers.

SSLSocket#pending corresponds to SSL_pending(). It reports data that is
already processed and is immediately available to read from the OpenSSL
library's internal buffer.

SSLSocket#wait_readable does not check for buffered data, either in the
OpenSSL library or in OpenSSL::Buffering, so it may block even when
data is already available to read.

This is different from IO#wait_readable. I considered changing
SSLSocket#wait_readable to check these buffers, but rejected it because
it is also used when the caller specifically needs to wait for new
records from the peer, particularly after SSLSocket#write_nonblock
returns :wait_readable.

This branch has not been deployed

No deployments
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.

1 participant