]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: stream_interface: remove the si->init
authorWilly Tarreau <w@1wt.eu>
Fri, 18 May 2012 13:15:26 +0000 (15:15 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 18 May 2012 13:15:26 +0000 (15:15 +0200)
Calling the init() function in sess_establish was a bad idea, it is
too late to allow it to fail on lack of resource and does not help at
all. Remove it for now before it's used.

include/types/stream_interface.h
src/proto_tcp.c
src/session.c
src/sock_raw.c
src/stream_interface.c

index dde7b3fe5a58e4c6d93671d18017679eef5ff920..0eb3730c8ac985f131b0aa9472924ee3dc5ff15d 100644 (file)
@@ -107,7 +107,6 @@ struct target {
 };
 
 struct sock_ops {
-       int (*init)(struct stream_interface *, void *); /* init function */
        void (*update)(struct stream_interface *);  /* I/O update function */
        void (*shutr)(struct stream_interface *);   /* shutr function */
        void (*shutw)(struct stream_interface *);   /* shutw function */
index 416dbf07c8c807ccf0878ae316d3691f87ede2db..3b6f9864240a4639a085df27a8ff855cc90633a1 100644 (file)
@@ -452,11 +452,11 @@ int tcp_connect_server(struct stream_interface *si)
        fdtab[fd].state = FD_STCONN; /* connection in progress */
        fdtab[fd].flags = FD_FL_TCP | FD_FL_TCP_NODELAY;
 
-       /* If we have nothing to send or if we want to initialize the sock layer,
-        * we want to confirm that the TCP connection is established before doing
-        * so, so we use our own write callback then switch to the sock layer.
+       /* If we have nothing to send, we want to confirm that the TCP
+        * connection is established before doing so, so we use our own write
+        * callback then switch to the sock layer.
         */
-       if (si->sock.init || ((si->ob->flags & BF_OUT_EMPTY) && !si->send_proxy_ofs)) {
+       if ((si->ob->flags & BF_OUT_EMPTY) && !si->send_proxy_ofs) {
                fdtab[fd].cb[DIR_RD].f = tcp_connect_read;
                fdtab[fd].cb[DIR_WR].f = tcp_connect_write;
        }
index a3becfebd47cdee74656d16c58048828a6440a1a..4760a350bc7ef120d97080c0cc7342a4e4dbac7f 100644 (file)
@@ -715,14 +715,6 @@ static void sess_establish(struct session *s, struct stream_interface *si)
                rep->rto = s->be->timeout.server;
        }
        req->wex = TICK_ETERNITY;
-
-       if (si->sock.init) {
-               /* initialize the socket layer if needed */
-               void *arg = NULL;
-               if (target_srv(&s->target))
-                       arg = target_srv(&s->target)->sock_init_arg;
-               si->sock.init(si, arg);
-       }
 }
 
 /* Update stream interface status for input states SI_ST_ASS, SI_ST_QUE, SI_ST_TAR.
index db38cd574e188ab2bb74c4a1034df2cb2f98f9d3..351195c5f062b7f8f26bb83d43e21fb89c400e6b 100644 (file)
@@ -1118,7 +1118,6 @@ static void sock_raw_chk_snd(struct stream_interface *si)
 
 /* stream sock operations */
 struct sock_ops sock_raw = {
-       .init    = NULL,
        .update  = sock_raw_data_finish,
        .shutr   = sock_raw_shutr,
        .shutw   = sock_raw_shutw,
index 69db42f240239f03cf0e676ae8b2a6221fa6f281..9dfda93a29511e5bba16e0b5276ef1d32beaabd2 100644 (file)
@@ -42,7 +42,6 @@ static void stream_int_chk_snd(struct stream_interface *si);
 
 /* socket operations for embedded tasks */
 struct sock_ops stream_int_embedded = {
-       .init    = NULL,
        .update  = stream_int_update_embedded,
        .shutr   = stream_int_shutr,
        .shutw   = stream_int_shutw,
@@ -54,7 +53,6 @@ struct sock_ops stream_int_embedded = {
 
 /* socket operations for external tasks */
 struct sock_ops stream_int_task = {
-       .init    = NULL,
        .update  = stream_int_update,
        .shutr   = stream_int_shutr,
        .shutw   = stream_int_shutw,