]> granicus.if.org Git - libevent/commitdiff
don't fail be_null_filter if bytes are copied
authorGreg Hazel <ghazel@gmail.com>
Wed, 21 Mar 2018 01:04:53 +0000 (18:04 -0700)
committerAzat Khuzhin <azat@libevent.org>
Sat, 2 Feb 2019 12:17:55 +0000 (15:17 +0300)
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)

bufferevent_filter.c

index 858d46844e528d89acda7a694328f06b1b328818..a7bdedddfe1d114bf199c45774640619365d29f0 100644 (file)
@@ -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;