[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] bufferevent_setwatermark() enables reading



On 2010-09-09 17:28, Simon Perreault wrote:
> Would this be the right fix?

Argh, git-send-email didn't do what I wanted it to do. Here's the patch
in attachment. Sorry.

Simon
-- 
NAT64/DNS64 open-source --> http://ecdysis.viagenie.ca
STUN/TURN server        --> http://numb.viagenie.ca
vCard 4.0               --> http://www.vcarddav.org
From 3cb5c4ce48a237c54d359baf92c31bef366c6d34 Mon Sep 17 00:00:00 2001
From: Simon Perreault <simon.perreault@xxxxxxxxxxx>
Date: Thu, 9 Sep 2010 17:19:20 -0400
Subject: [PATCH] Obey enabled status when unsuspending

---
 bufferevent.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/bufferevent.c b/bufferevent.c
index cebce8c..789310a 100644
--- a/bufferevent.c
+++ b/bufferevent.c
@@ -78,7 +78,7 @@ bufferevent_unsuspend_read(struct bufferevent *bufev, short what)
 	    EVUTIL_UPCAST(bufev, struct bufferevent_private, bev);
 	BEV_LOCK(bufev);
 	bufev_private->read_suspended &= ~what;
-	if (!bufev_private->read_suspended)
+	if (!bufev_private->read_suspended && (bufev->enabled & EV_READ))
 		bufev->be_ops->enable(bufev, EV_READ);
 	BEV_UNLOCK(bufev);
 }
@@ -102,7 +102,7 @@ bufferevent_unsuspend_write(struct bufferevent *bufev, short what)
 	    EVUTIL_UPCAST(bufev, struct bufferevent_private, bev);
 	BEV_LOCK(bufev);
 	bufev_private->write_suspended &= ~what;
-	if (!bufev_private->write_suspended)
+	if (!bufev_private->write_suspended && (bufev->enabled & EV_WRITE))
 		bufev->be_ops->enable(bufev, EV_WRITE);
 	BEV_UNLOCK(bufev);
 }
-- 
1.7.1