1 Upstream-Status: Inappropriate [1]
3 [1] ported from libevent-2.0.21-4.el7.tis.2.src.rpm
5 Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
7 http.c | 25 ++++++++++++++++++-------
8 1 file changed, 18 insertions(+), 7 deletions(-)
12 @@ -1325,6 +1325,9 @@ evhttp_error_cb(struct bufferevent *bufe
13 struct evhttp_connection *evcon = arg;
14 struct evhttp_request *req = TAILQ_FIRST(&evcon->requests);
16 + if (evcon->fd == -1)
17 + evcon->fd = bufferevent_getfd(bufev);
19 switch (evcon->state) {
20 case EVCON_CONNECTING:
21 if (what & BEV_EVENT_TIMEOUT) {
22 @@ -1390,6 +1393,9 @@ evhttp_connection_cb(struct bufferevent
24 ev_socklen_t errsz = sizeof(error);
26 + if (evcon->fd == -1)
27 + evcon->fd = bufferevent_getfd(bufev);
29 if (!(what & BEV_EVENT_CONNECTED)) {
30 /* some operating systems return ECONNREFUSED immediately
31 * when connecting to a local address. the cleanup is going
32 @@ -2189,16 +2195,21 @@ evhttp_connection_connect(struct evhttp_
33 EVUTIL_ASSERT(!(evcon->flags & EVHTTP_CON_INCOMING));
34 evcon->flags |= EVHTTP_CON_OUTGOING;
36 - evcon->fd = bind_socket(
37 - evcon->bind_address, evcon->bind_port, 0 /*reuse*/);
38 - if (evcon->fd == -1) {
39 - event_debug(("%s: failed to bind to \"%s\"",
40 - __func__, evcon->bind_address));
42 + if (evcon->bind_address || evcon->bind_port) {
43 + evcon->fd = bind_socket(
44 + evcon->bind_address, evcon->bind_port, 0 /*reuse*/);
45 + if (evcon->fd == -1) {
46 + event_debug(("%s: failed to bind to \"%s\"",
47 + __func__, evcon->bind_address));
51 + bufferevent_setfd(evcon->bufev, evcon->fd);
53 + bufferevent_setfd(evcon->bufev, -1);
56 /* Set up a callback for successful connection setup */
57 - bufferevent_setfd(evcon->bufev, evcon->fd);
58 bufferevent_setcb(evcon->bufev,
59 NULL /* evhttp_read_cb */,
60 NULL /* evhttp_write_cb */,