From d3dcb5aca99ec5ff064b40c756f199871ef1bd45 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Sun, 27 Jan 2019 15:16:39 +0300 Subject: [PATCH] http: do not call deferred readcb if readcb is not set Otherwise evhttp_read_cb can be called with invalid connection state: http/read_on_write_error: [forking] [msg] libevent using: kqueue FAIL ../test/regress_http.c:4079: assert(req) FAIL ../test/regress_http.c:4087: assert(req)[err] evhttp_read_cb: illegal connection state 0 --- http.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/http.c b/http.c index 17d45804..4e114b70 100644 --- a/http.c +++ b/http.c @@ -1171,7 +1171,9 @@ static void evhttp_deferred_read_cb(struct event_callback *cb, void *data) { struct evhttp_connection *evcon = data; - evhttp_read_cb(evcon->bufev, evcon); + struct bufferevent *bev = evcon->bufev; + if (bev->readcb) + (bev->readcb)(evcon->bufev, evcon); } static void -- 2.40.0