Mailing List Archive

Patch to allow shared UnixSocketDir
This is a multi-part message in MIME format.
--------------040304010506090600000108
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Some of my servers run multiple instances of apache, listening on
different ports or IPs. It seems like needing a separate UnixSocketDir
for each one is not really necessary -- the "arriba" could be calculated
by the first server started, and then read by the rest. The only problem
is the "bparent" file, which it seems like should be unique for each
server instance.

The attached patch prepends the server_hostname and port from the
server_rec to the name, allowing more than one server to point to the
same UnixSocketDir, as long as they don't have an identical hostname and
port in their server_rec.

The patch is against 1.2.2.

--
Mike Cramer
http://www.webkist.com/

--------------040304010506090600000108
Content-Type: text/plain;
name="bh-1.2.2-bparent.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="bh-1.2.2-bparent.patch"

Index: back_util.c
===================================================================
RCS file: /storage/cvs/jesus/mod_backhand/back_util.c,v
retrieving revision 1.20
diff -b -B -u -r1.20 back_util.c
--- back_util.c 13 Sep 2002 01:21:11 -0000 1.20
+++ back_util.c 10 Sep 2003 19:59:28 -0000
@@ -342,7 +342,8 @@
}

/* Create a Unix Domain socket for passing TCP/IP sessions */
- ap_snprintf(ud_fn, MAXPATHLEN, "%s/bparent", UD_DN);
+ ap_snprintf(ud_fn, MAXPATHLEN, "%s/%s-%d-bparent", UD_DN,
+ s->server_hostname, s->port);
ufd = serv_listen(ud_fn);
if(ufd<0) {
if(loglevel & MBLL_NET4) {
Index: mod_backhand.c
===================================================================
RCS file: /storage/cvs/jesus/mod_backhand/mod_backhand.c,v
retrieving revision 1.53
diff -b -B -u -r1.53 mod_backhand.c
--- mod_backhand.c 17 Nov 2002 02:43:41 -0000 1.53
+++ mod_backhand.c 10 Sep 2003 19:59:28 -0000
@@ -1091,7 +1091,8 @@
getpid(), mpid);
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, s, buffer);
for(i=0;i<10;i++) {
- ap_snprintf(buffer, MAXPATHLEN, "%s/bparent", UD_DN);
+ ap_snprintf(buffer, MAXPATHLEN, "%s/%s-%d-bparent",
+ UD_DN, s->server_hostname, s->port);
afd = cli_conn(buffer, UD_DN);
if(afd<0) {
sleep(1);
@@ -1132,7 +1133,8 @@

static void establish_umbilical(server_rec *s) {
char buffer[MAXPATHLEN];
- ap_snprintf(buffer, MAXPATHLEN, "%s/bparent", UD_DN);
+ ap_snprintf(buffer, MAXPATHLEN, "%s/%s-%d-bparent",
+ UD_DN, s->server_hostname, s->port);
umbilical = cli_conn(buffer, UD_DN);
if(umbilical < 0) {
ap_log_error(APLOG_MARK, APLOG_ERR, s,

--------------040304010506090600000108--
Patch to allow shared UnixSocketDir [ In reply to ]
Applied to HEAD.

On Wednesday, Sep 10, 2003, at 15:55 US/Eastern, Mike Cramer wrote:

> Some of my servers run multiple instances of apache, listening on
> different ports or IPs. It seems like needing a separate UnixSocketDir
> for each one is not really necessary -- the "arriba" could be
> calculated by the first server started, and then read by the rest. The
> only problem is the "bparent" file, which it seems like should be
> unique for each server instance.
>
> The attached patch prepends the server_hostname and port from the
> server_rec to the name, allowing more than one server to point to the
> same UnixSocketDir, as long as they don't have an identical hostname
> and port in their server_rec.
>
> The patch is against 1.2.2.
>
>
// Theo Schlossnagle
// Principal Engineer -- http://www.omniti.com/~jesus/
// Postal Engine -- http://www.postalengine.com/
// Ecelerity: fastest MTA on earth