From e050703d474b2d73abebb4b133f9fc504fadd9a8 Mon Sep 17 00:00:00 2001 From: Joachim Bauch Date: Mon, 4 Jul 2011 11:36:14 -0400 Subject: [PATCH] Fix bug in SSL bufferevents backed by a bev with a write high-watermarks Original mail: the logic that handles write watermarks in "bio_bufferevent_write" is not working. It currently doesn't write any data if the high watermark is *above* the amount of data to write (i.e. when there is actually enough room available). --- bufferevent_openssl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bufferevent_openssl.c b/bufferevent_openssl.c index 02a6222a..273be8fb 100644 --- a/bufferevent_openssl.c +++ b/bufferevent_openssl.c @@ -170,8 +170,8 @@ bio_bufferevent_write(BIO *b, const char *in, int inlen) /* Copy only as much data onto the output buffer as can fit under the * high-water mark. */ - if (bufev->wm_write.high && bufev->wm_write.high >= (outlen+inlen)) { - if (bufev->wm_write.high >= outlen) { + if (bufev->wm_write.high && bufev->wm_write.high <= (outlen+inlen)) { + if (bufev->wm_write.high <= outlen) { /* If no data can fit, we'll need to retry later. */ BIO_set_retry_write(b); return -1;