]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: peers: now remove the remote connection setup code
authorWilly Tarreau <w@1wt.eu>
Thu, 18 Jul 2019 15:21:24 +0000 (17:21 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 19 Jul 2019 11:50:09 +0000 (13:50 +0200)
The connection is not needed anymore, the backend does the job.

src/peers.c

index 6d66553c65b64a483df677adf4bb380f1b5cd1fa..cb6998c58cf1875eb36926c5a81c5e46fd662097 100644 (file)
@@ -2489,8 +2489,6 @@ static struct appctx *peer_session_create(struct peers *peers, struct peer *peer
        struct appctx *appctx;
        struct session *sess;
        struct stream *s;
-       struct connection *conn;
-       struct conn_stream *cs;
 
        peer->reconnect = tick_add(now_ms, MS_TO_TICKS(PEER_RECONNECT_TIMEOUT));
        peer->heartbeat = tick_add(now_ms, MS_TO_TICKS(PEER_HEARTBEAT_TIMEOUT));
@@ -2515,11 +2513,6 @@ static struct appctx *peer_session_create(struct peers *peers, struct peer *peer
                goto out_free_sess;
        }
 
-       /* The tasks below are normally what is supposed to be done by
-        * fe->accept().
-        */
-       s->flags = SF_ASSIGNED|SF_ADDR_SET;
-
        /* applet is waiting for data */
        si_cant_get(&s->si[0]);
        appctx_wakeup(appctx);
@@ -2529,31 +2522,8 @@ static struct appctx *peer_session_create(struct peers *peers, struct peer *peer
        if (!sockaddr_alloc(&s->target_addr))
                goto out_free_strm;
        *s->target_addr = peer->addr;
+       s->flags = SF_ASSIGNED|SF_ADDR_SET;
        s->si[1].flags |= SI_FL_NOLINGER;
-       si_set_state(&s->si[1], SI_ST_ASS);
-
-       /* FIXME WTA: the connection below should now be totally useless */
-
-       /* automatically prepare the stream interface to connect to the
-        * pre-initialized connection in si->conn.
-        */
-       if (unlikely((conn = conn_new()) == NULL))
-               goto out_free_strm;
-
-       if (unlikely((cs = cs_new(conn)) == NULL))
-               goto out_free_conn;
-
-       conn->target = s->target;
-
-       if (!sockaddr_alloc(&conn->dst))
-               goto out_free_cs;
-
-       memcpy(conn->dst, &peer->addr, sizeof(*conn->dst));
-
-       conn_prepare(conn, peer->proto, peer_xprt(peer));
-       if (conn_install_mux(conn, &mux_pt_ops, cs, s->be, NULL) < 0)
-               goto out_free_cs;
-       si_attach_cs(&s->si[1], cs);
 
        s->do_log = NULL;
        s->uniq_id = 0;
@@ -2566,10 +2536,6 @@ static struct appctx *peer_session_create(struct peers *peers, struct peer *peer
        return appctx;
 
        /* Error unrolling */
-out_free_cs:
-       cs_free(cs);
- out_free_conn:
-       conn_free(conn);
  out_free_strm:
        LIST_DEL(&s->list);
        pool_free(pool_head_stream, s);