From f719b8a9185d9cf533c91fbd1ef206a7dffad37a Mon Sep 17 00:00:00 2001 From: Joachim Bauch Date: Mon, 3 Sep 2012 21:42:15 +0200 Subject: [PATCH 1/2] Stop looping in "consider_reading" if reading is suspended. --- bufferevent_openssl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bufferevent_openssl.c b/bufferevent_openssl.c index fdbec280..06e45110 100644 --- a/bufferevent_openssl.c +++ b/bufferevent_openssl.c @@ -783,6 +783,9 @@ consider_reading(struct bufferevent_openssl *bev_ssl) if (r & (OP_BLOCKED|OP_ERR)) break; + if (bev_ssl->bev.read_suspended) + break; + /* Read all pending data. This won't hit the network * again, and will (most importantly) put us in a state * where we don't need to read anything else until the From 1acf2ebcff7769ce63f4b8dfbcc863a273f75a13 Mon Sep 17 00:00:00 2001 From: Joachim Bauch Date: Thu, 6 Sep 2012 10:01:10 +0200 Subject: [PATCH 2/2] No need to reserve space if reading is suspended. Conflicts: bufferevent_openssl.c --- bufferevent_openssl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bufferevent_openssl.c b/bufferevent_openssl.c index 06e45110..922ae06c 100644 --- a/bufferevent_openssl.c +++ b/bufferevent_openssl.c @@ -562,7 +562,7 @@ decrement_buckets(struct bufferevent_openssl *bev_ssl) /* Return a bitmask of OP_MADE_PROGRESS (if we read anything); OP_BLOCKED (if we're now blocked); and OP_ERR (if an error occurred). */ - static int +static int do_read(struct bufferevent_openssl *bev_ssl, int n_to_read) { /* Requires lock */ struct bufferevent *bev = &bev_ssl->bev.bev; @@ -571,6 +571,9 @@ do_read(struct bufferevent_openssl *bev_ssl, int n_to_read) { struct evbuffer_iovec space[2]; int result = 0; + if (bev_ssl->bev.read_suspended) + return 0; + atmost = _bufferevent_get_read_max(&bev_ssl->bev); if (n_to_read > atmost) n_to_read = atmost;