]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: stream_interface: stop exporting socket layer functions
authorWilly Tarreau <w@1wt.eu>
Fri, 11 May 2012 15:47:17 +0000 (17:47 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 11 May 2012 15:47:17 +0000 (17:47 +0200)
Similarly to the previous patch, we don't need the socket-layer functions
outside of stream_interface. They could even move to a file dedicated to
applets, though that does not seem particularly useful at the moment.

include/proto/stream_interface.h
src/peers.c
src/session.c
src/stream_interface.c

index 5446786bebe370d8ae23b5e7a0e7ba760ee01363..ad5ae6871b7bf243dfa674f79a86615d594254a4 100644 (file)
@@ -2,7 +2,7 @@
  * include/proto/stream_interface.h
  * This file contains stream_interface function prototypes
  *
- * Copyright (C) 2000-2011 Willy Tarreau - w@1wt.eu
+ * Copyright (C) 2000-2012 Willy Tarreau - w@1wt.eu
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -33,14 +33,6 @@ int stream_int_check_timeouts(struct stream_interface *si);
 void stream_int_report_error(struct stream_interface *si);
 void stream_int_retnclose(struct stream_interface *si, const struct chunk *msg);
 
-/* functions used when running a stream interface as a task */
-void stream_int_update(struct stream_interface *si);
-void stream_int_update_embedded(struct stream_interface *si);
-void stream_int_shutr(struct stream_interface *si);
-void stream_int_shutw(struct stream_interface *si);
-void stream_int_chk_rcv(struct stream_interface *si);
-void stream_int_chk_snd(struct stream_interface *si);
-
 extern struct sock_ops stream_int_embedded;
 extern struct sock_ops stream_int_task;
 
index 016a05f40233a57f8432a3d51ab5246d450622a3..5456410b58dd281fbcf96c21d685cf946e39f1d6 100644 (file)
@@ -1177,13 +1177,12 @@ static struct session *peer_session_create(struct peer *peer, struct peer_sessio
        s->si[1].release = NULL;
        s->si[1].send_proxy_ofs = 0;
        set_target_proxy(&s->si[1].target, s->be);
+       stream_interface_prepare(&s->si[1], &sock_raw);
        s->si[1].exp = TICK_ETERNITY;
        s->si[1].flags = SI_FL_NONE;
        if (s->be->options2 & PR_O2_INDEPSTR)
                s->si[1].flags |= SI_FL_INDEP_STR;
 
-       stream_interface_prepare(&s->si[1], &sock_raw);
-
        session_init_srv_conn(s);
        set_target_proxy(&s->target, s->be);
        s->pend_pos = NULL;
index 2cb8b664eb4a3d9cd498af9ef644e08bcfefa512..cd80b8a155b9d9cf4d686da3041210c672f17f73 100644 (file)
@@ -199,8 +199,7 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
        s->si[1].release   = NULL;
        s->si[1].send_proxy_ofs = 0;
        clear_target(&s->si[1].target);
-       s->si[1].sock.shutr= stream_int_shutr;
-       s->si[1].sock.shutw= stream_int_shutw;
+       stream_interface_prepare(&s->si[1], &stream_int_embedded);
        s->si[1].exp       = TICK_ETERNITY;
        s->si[1].flags     = SI_FL_NONE;
 
index 75a6dc9d4a90d53d2eb750882c4c2b849ba6b827..9dfda93a29511e5bba16e0b5276ef1d32beaabd2 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Functions managing stream_interface structures
  *
- * Copyright 2000-2011 Willy Tarreau <w@1wt.eu>
+ * Copyright 2000-2012 Willy Tarreau <w@1wt.eu>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
 #include <proto/stream_interface.h>
 #include <proto/task.h>
 
+/* socket functions used when running a stream interface as a task */
+static void stream_int_update(struct stream_interface *si);
+static void stream_int_update_embedded(struct stream_interface *si);
+static void stream_int_shutr(struct stream_interface *si);
+static void stream_int_shutw(struct stream_interface *si);
+static void stream_int_chk_rcv(struct stream_interface *si);
+static void stream_int_chk_snd(struct stream_interface *si);
+
 /* socket operations for embedded tasks */
 struct sock_ops stream_int_embedded = {
        .update  = stream_int_update_embedded,
@@ -107,7 +115,7 @@ void stream_int_retnclose(struct stream_interface *si, const struct chunk *msg)
 }
 
 /* default update function for scheduled tasks, not used for embedded tasks */
-void stream_int_update(struct stream_interface *si)
+static void stream_int_update(struct stream_interface *si)
 {
        DPRINTF(stderr, "%s: si=%p, si->state=%d ib->flags=%08x ob->flags=%08x\n",
                __FUNCTION__,
@@ -118,7 +126,7 @@ void stream_int_update(struct stream_interface *si)
 }
 
 /* default update function for embedded tasks, to be used at the end of the i/o handler */
-void stream_int_update_embedded(struct stream_interface *si)
+static void stream_int_update_embedded(struct stream_interface *si)
 {
        int old_flags = si->flags;
 
@@ -197,7 +205,7 @@ void stream_int_update_embedded(struct stream_interface *si)
 }
 
 /* default shutr function for scheduled tasks */
-void stream_int_shutr(struct stream_interface *si)
+static void stream_int_shutr(struct stream_interface *si)
 {
        DPRINTF(stderr, "%s: si=%p, si->state=%d ib->flags=%08x ob->flags=%08x\n",
                __FUNCTION__,
@@ -227,7 +235,7 @@ void stream_int_shutr(struct stream_interface *si)
 }
 
 /* default shutw function for scheduled tasks */
-void stream_int_shutw(struct stream_interface *si)
+static void stream_int_shutw(struct stream_interface *si)
 {
        DPRINTF(stderr, "%s: si=%p, si->state=%d ib->flags=%08x ob->flags=%08x\n",
                __FUNCTION__,
@@ -268,7 +276,7 @@ void stream_int_shutw(struct stream_interface *si)
 }
 
 /* default chk_rcv function for scheduled tasks */
-void stream_int_chk_rcv(struct stream_interface *si)
+static void stream_int_chk_rcv(struct stream_interface *si)
 {
        struct buffer *ib = si->ib;
 
@@ -293,7 +301,7 @@ void stream_int_chk_rcv(struct stream_interface *si)
 }
 
 /* default chk_snd function for scheduled tasks */
-void stream_int_chk_snd(struct stream_interface *si)
+static void stream_int_chk_snd(struct stream_interface *si)
 {
        struct buffer *ob = si->ob;