From: Willy Tarreau Date: Fri, 11 May 2012 15:47:17 +0000 (+0200) Subject: CLEANUP: stream_interface: stop exporting socket layer functions X-Git-Tag: v1.5-dev10~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f873d754f820c8e86d773859673b9a70a481bf92;p=thirdparty%2Fhaproxy.git CLEANUP: stream_interface: stop exporting socket layer functions 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. --- diff --git a/include/proto/stream_interface.h b/include/proto/stream_interface.h index 5446786beb..ad5ae6871b 100644 --- a/include/proto/stream_interface.h +++ b/include/proto/stream_interface.h @@ -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; diff --git a/src/peers.c b/src/peers.c index 016a05f402..5456410b58 100644 --- a/src/peers.c +++ b/src/peers.c @@ -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; diff --git a/src/session.c b/src/session.c index 2cb8b664eb..cd80b8a155 100644 --- a/src/session.c +++ b/src/session.c @@ -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; diff --git a/src/stream_interface.c b/src/stream_interface.c index 75a6dc9d4a..9dfda93a29 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -1,7 +1,7 @@ /* * Functions managing stream_interface structures * - * Copyright 2000-2011 Willy Tarreau + * Copyright 2000-2012 Willy Tarreau * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -32,6 +32,14 @@ #include #include +/* 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;