From: Greg Hazel Date: Wed, 21 Mar 2018 01:04:53 +0000 (-0700) Subject: don't fail be_null_filter if bytes are copied X-Git-Tag: release-2.1.9-beta^2~131 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b92b07924df198312fc7e0f53f96d4057723967f;p=libevent don't fail be_null_filter if bytes are copied Otherwise it will not reset timeouts for the IO, but other things should still works correctly. Also evbuffer_remove_buffer() could return 0, due to empty buffers, for example during flushing bufferevent, so let's count this is BEV_OK too. (cherry picked from commit 4ba48739673060baea581774992970fa46c2f813) --- diff --git a/bufferevent_filter.c b/bufferevent_filter.c index 858d4684..a7bdeddd 100644 --- a/bufferevent_filter.c +++ b/bufferevent_filter.c @@ -160,7 +160,7 @@ be_null_filter(struct evbuffer *src, struct evbuffer *dst, ev_ssize_t lim, enum bufferevent_flush_mode state, void *ctx) { (void)state; - if (evbuffer_remove_buffer(src, dst, lim) == 0) + if (evbuffer_remove_buffer(src, dst, lim) >= 0) return BEV_OK; else return BEV_ERROR;