Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/patches-2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
nmathewson committed Feb 6, 2012
2 parents 4dee4cc + 5b4b812 commit c00416f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions bufferevent_openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,23 @@ consider_reading(struct bufferevent_openssl *bev_ssl)
* already been done, since OpenSSL went and read a
* whole SSL record anyway. */
n_to_read = SSL_pending(bev_ssl->ssl);

/* XXX This if statement is actually a bad bug, added to avoid
* XXX a worse bug.
*
* The bad bug: It can potentially cause resource unfairness
* by reading too much data from the underlying bufferevent;
* it can potentially cause read looping if the underlying
* bufferevent is a bufferevent_pair and deferred callbacks
* aren't used.
*
* The worse bug: If we didn't do this, then we would
* potentially not read any more from bev_ssl->underlying
* until more data arrived there, which could lead to us
* waiting forever.
*/
if (!n_to_read && bev_ssl->underlying)
n_to_read = bytes_to_read(bev_ssl);
}

if (!bev_ssl->underlying) {
Expand Down

0 comments on commit c00416f

Please sign in to comment.