Mailing List Archive

Multiple server instances on one machine
This is a multi-part message in MIME format.
--------------060808000702090108010704
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Here's a small patch that should fix the case where two apache instances
are running on different ports, on the same machine, broadcasting the
same IP address. Very simply, when adding a machine to the serverstats
list it should check to see if an entry exists which matches BOTH the IP
address and port, not just the IP.

With this patch all the instances show up properly on the
backhand-handler page.

--Mike Cramer

--------------060808000702090108010704
Content-Type: text/plain;
name="sin_port-compare.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="sin_port-compare.patch"

Index: mod_backhand/back_util.c
===================================================================
RCS file: /storage/cvs/jesus/mod_backhand/back_util.c,v
retrieving revision 1.15
diff -u -r1.15 back_util.c
--- mod_backhand/back_util.c 2001/07/06 01:09:38 1.15
+++ mod_backhand/back_util.c 2001/10/23 18:49:46
@@ -517,9 +517,10 @@
astat.mtime = time(NULL);
/* Copy it into the shared memory... if it is already there */
for(j=-1, i=0; i<MAXSERVERS; i++) { /* as if has been inserted */
- if(memcmp(&(serverstats[i].contact.sin_addr),
+ if((memcmp(&(serverstats[i].contact.sin_addr),
&astat.contact.sin_addr,
- sizeof(struct in_addr))==0) {
+ sizeof(struct in_addr))==0) &&
+ (serverstats[i].contact.sin_port == astat.contact.sin_port)) {
memcpy(&serverstats[i], &astat, sizeof(serverstat));
j=-1; /* has been inserted */
break;

--------------060808000702090108010704--
Multiple server instances on one machine [ In reply to ]
Michael Cramer wrote:
> Here's a small patch that should fix the case where two apache instances
> are running on different ports, on the same machine, broadcasting the
> same IP address. Very simply, when adding a machine to the serverstats
> list it should check to see if an entry exists which matches BOTH the IP
> address and port, not just the IP.
>
> With this patch all the instances show up properly on the
> backhand-handler page.

These have been committed to CVS. Thanks.
--
Theo Schlossnagle
1024D/82844984/95FD 30F1 489E 4613 F22E 491A 7E88 364C 8284 4984
2047R/33131B65/71 F7 95 64 49 76 5D BA 3D 90 B9 9F BE 27 24 E7