Subject: | ssl_write_all() interacts poorly with EAGAIN |
Date: | Tue, 9 Jul 2019 17:39:04 -0400 |
To: | bug-Net-SSLeay [...] rt.cpan.org |
From: | Felipe Gasper <felipe [...] felipegasper.com> |
I confirmed recently that if ssl_write_all() is called over and over on a socket and the peer doesn’t read, then
ssl_write_all() will block indefinitely. This applies even with a non-blocking socket--and it’s worse because in that case a tight write() loop happens.
While ssl_write_all() is documented as a “blocking” function, it seems like this function’s behavior could be a bit more helpful for non-blocking sockets (and blocking sockets with a socket-level timeout set), which by their nature are expected to indicate when the write buffer is full.
That said, it may be too risky of a change to apply to the existing function … in which case, would it work to create an ssl_write_all_nb() function that works as I describe?
Thank you for your time.
-Felipe Gasper
Mississauga, Ontario