drbd-utils: update for stx 5.0
[pti/rtp.git] / meta-starlingx / meta-stx-integ / recipes-support / libevent / libevent / libevent-ipv6-client-socket.patch
1 Upstream-Status: Inappropriate [1]
2
3 [1] ported from libevent-2.0.21-4.el7.tis.2.src.rpm
4
5 Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
6 ---
7  http.c |   25 ++++++++++++++++++-------
8  1 file changed, 18 insertions(+), 7 deletions(-)
9
10 --- a/http.c
11 +++ b/http.c
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);
15
16 +       if (evcon->fd == -1)
17 +               evcon->fd = bufferevent_getfd(bufev);
18 +
19         switch (evcon->state) {
20         case EVCON_CONNECTING:
21                 if (what & BEV_EVENT_TIMEOUT) {
22 @@ -1390,6 +1393,9 @@ evhttp_connection_cb(struct bufferevent
23         int error;
24         ev_socklen_t errsz = sizeof(error);
25
26 +       if (evcon->fd == -1)
27 +               evcon->fd = bufferevent_getfd(bufev);
28 +
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;
35
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));
41 -               return (-1);
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));
48 +                       return (-1);
49 +               }
50 +
51 +               bufferevent_setfd(evcon->bufev, evcon->fd);
52 +       } else {
53 +               bufferevent_setfd(evcon->bufev, -1);
54         }
55
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 */,