Previously, if some sender were generating data to read on an
OpenSSL connection as fast as we could process it, we could easily
wind up looping on an openssl do_read operation without ever
considering other sockets.
The difference between this and the original method in
consider_reading() is that it only loops for a single completed
*frame* instead of looping until fd is drained or an error condition
was triggered.
{Patch split out by nickm}
if (bev_ssl->write_blocked_on_read)
return;
- while ((n_to_read = bytes_to_read(bev_ssl)) != 0) {
- r = do_read(bev_ssl, n_to_read);
- if (r <= 0)
+ n_to_read = bytes_to_read(bev_ssl);
+
+ while (n_to_read) {
+ if (do_read(bev_ssl, n_to_read) <= 0)
break;
+
+ n_to_read = SSL_pending(bev_ssl->ssl);
}
if (!bev_ssl->underlying) {