Return-Path: Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 49170 invoked by uid 500); 25 Mar 2003 03:18:43 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 49157 invoked from network); 25 Mar 2003 03:18:43 -0000 Subject: Re: [Patch] ap_alloc_listener From: "Philippe M. Chiasson" To: trawick@attglobal.net Cc: dev@httpd.apache.org In-Reply-To: <3E57734F.8020000@attglobal.net> References: <1044275221.1647.19.camel@shou.sg.ectoplasm.org> <3E57734F.8020000@attglobal.net> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-sw3Bk+s8GFZCX7FgC2mL" X-Mailer: Ximian Evolution 1.0.8 (1.0.8-10) Date: 25 Mar 2003 11:18:47 +0800 Message-Id: <1048562331.18837.9.camel@exarkhun.eXtropia.com> Mime-Version: 1.0 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N --=-sw3Bk+s8GFZCX7FgC2mL Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Sat, 2003-02-22 at 20:55, Jeff Trawick wrote: > Philippe M. Chiasson wrote: >=20 > > In trying to write a protocol module for a protocol type !=3D TCP, I ha= d > > to duplicate the logic of both alloc_listener and find_default_family > > from server/listen.c. > > > > I believe that if a module wants to push a new listener socket on > > ap_listeners, the module should simply do: > > > > ap_alloc_listener(process, hostname, port, type); >=20 >=20 > +1 in concept Thanks, that's great. With this patch applied, mod_udp would have significantly less redundant code. =20 > > The following patch exposes alloc_listener as ap_alloc_listener and > > takes an extra type argument. > > > > Index: server/listen.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > RCS file: /home/cvspublic/httpd-2.0/server/listen.c,v > > retrieving revision 1.84 > > diff -u -b -B -r1.84 listen.c > > --- server/listen.c 22 Nov 2002 12:23:10 -0000 1.84 > > +++ server/listen.c 3 Feb 2003 12:10:27 -0000 > > @@ -266,8 +266,7 @@ > > #endif > > } > > > > - > > -static const char *alloc_listener(process_rec *process, char *addr,=20 > > apr_port_t port) > > +const char *ap_alloc_listener(process_rec *process, char *addr,=20 > > apr_port_t port, int type) >=20 >=20 > you need to use AP_DECLARE here too, as in >=20 > AP_DECLARE(const char *) ap_alloc_listener(blah blah blah) Corrected # $Id: ap_alloc_listener.patch,v 1.2 2003/03/25 03:16:27 gozer Exp $ This patch has been submitted to the asf for inclusion. Once applied, define AP_ALLOC_LISTENER in mod_udp_listen.h Index: include/ap_listen.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/cvspublic/httpd-2.0/include/ap_listen.h,v retrieving revision 1.30 diff -u -b -B -r1.30 ap_listen.h --- include/ap_listen.h 13 Mar 2002 20:47:42 -0000 1.30 +++ include/ap_listen.h 3 Feb 2003 12:10:27 -0000 @@ -149,4 +149,6 @@ AP_INIT_TAKE1("SendBufferSize", ap_set_send_buffer_size, NULL, RSRC_CONF, = \ "Send buffer size in bytes") =20 +AP_DECLARE(const char*) ap_alloc_listener(process_rec *process, char *addr= , apr_port_t port, int type); + #endif Index: server/listen.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/cvspublic/httpd-2.0/server/listen.c,v retrieving revision 1.84 diff -u -b -B -r1.84 listen.c --- server/listen.c 22 Nov 2002 12:23:10 -0000 1.84 +++ server/listen.c 3 Feb 2003 12:10:27 -0000 @@ -266,8 +266,7 @@ #endif } =20 - -static const char *alloc_listener(process_rec *process, char *addr, apr_po= rt_t port) +AP_DECLARE(const char *) ap_alloc_listener(process_rec *process, char *add= r, apr_port_t port, int type) { ap_listen_rec **walk; ap_listen_rec *new; @@ -323,7 +322,7 @@ } if ((status =3D apr_socket_create(&new->sd, new->bind_addr->family, - SOCK_STREAM, process->pool)) + type, process->pool)) !=3D APR_SUCCESS) { ap_log_perror(APLOG_MARK, APLOG_CRIT, status, process->pool, "alloc_listener: failed to get a socket for %s", add= r); @@ -429,7 +428,7 @@ return "Port must be specified"; } =20 - return alloc_listener(cmd->server->process, host, port); + return ap_alloc_listener(cmd->server->process, host, port, SOCK_STREAM= ); } =20 const char *ap_set_listenbacklog(cmd_parms *cmd, void *dummy, const char *= arg) --=-sw3Bk+s8GFZCX7FgC2mL Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQA+f8qXyzKhB4jDpaURApFnAKDBY0EceqCUjPtahgyOTBAGtySq8QCfYacN C2KB0TWVH8E1at7BbnQ4Vs4= =vPPi -----END PGP SIGNATURE----- --=-sw3Bk+s8GFZCX7FgC2mL--