diff -c -C2 src//cache_cf.c /var3/src/squid/squid-1.1.10-ltd/src//cache_cf.c *** src//cache_cf.c Thu Apr 24 05:38:36 1997 --- /var3/src/squid/squid-1.1.10-ltd/src//cache_cf.c Fri May 23 19:18:04 1997 *************** *** 859,863 **** if (i < 0) i = 0; ! Config.Port.http = (u_short) i; } --- 859,870 ---- if (i < 0) i = 0; ! ! if (Config.Port.number_http == MAXHTTPPORTS) { ! sprintf(fatal_str,"Limit of %d HTTP Ports reached. Redefine MAXHTTPPORTS for more.\n", ! MAXHTTPPORTS); ! fatal(fatal_str); ! } ! ! Config.Port.http[Config.Port.number_http++] = (u_short) i; } *************** *** 1563,1568 **** Config.appendDomain = safe_xstrdup(DefaultAppendDomain); Config.errHtmlText = safe_xstrdup(DefaultErrHtmlText); ! Config.Port.http = DefaultHttpPortNum; Config.Port.icp = DefaultIcpPortNum; Config.Log.log_fqdn = DefaultLogLogFqdn; Config.Log.log = safe_xstrdup(DefaultCacheLogFile); --- 1570,1576 ---- Config.appendDomain = safe_xstrdup(DefaultAppendDomain); Config.errHtmlText = safe_xstrdup(DefaultErrHtmlText); ! Config.Port.http[0] = DefaultHttpPortNum; Config.Port.icp = DefaultIcpPortNum; + Config.Port.number_http = 0; Config.Log.log_fqdn = DefaultLogLogFqdn; Config.Log.log = safe_xstrdup(DefaultCacheLogFile); *************** *** 1637,1641 **** sprintf(ThisCache, "%s:%d (Squid/%s)", getMyHostname(), ! (int) Config.Port.http, SQUID_VERSION); if (!Config.udpMaxHitObjsz || Config.udpMaxHitObjsz > SQUID_UDP_SO_SNDBUF) --- 1645,1649 ---- sprintf(ThisCache, "%s:%d (Squid/%s)", getMyHostname(), ! (int) Config.Port.http[0], SQUID_VERSION); if (!Config.udpMaxHitObjsz || Config.udpMaxHitObjsz > SQUID_UDP_SO_SNDBUF) diff -c -C2 src//cache_cf.h /var3/src/squid/squid-1.1.10-ltd/src//cache_cf.h *** src//cache_cf.h Sat Mar 29 07:28:12 1997 --- /var3/src/squid/squid-1.1.10-ltd/src//cache_cf.h Fri May 23 19:19:13 1997 *************** *** 110,113 **** --- 110,115 ---- #define DefaultRedirectChildrenMax 32 /* 32 processes */ + #define MAXHTTPPORTS 12 /* can bind to up to 12 ports */ + typedef struct _wordlist { char *key; *************** *** 164,169 **** int maxRequestSize; struct { ! u_short http; u_short icp; } Port; struct { --- 166,172 ---- int maxRequestSize; struct { ! u_short http[MAXHTTPPORTS]; u_short icp; + u_short number_http; } Port; struct { diff -c -C2 src//client_db.c /var3/src/squid/squid-1.1.10-ltd/src//client_db.c *** src//client_db.c Wed Mar 26 18:29:36 1997 --- /var3/src/squid/squid-1.1.10-ltd/src//client_db.c Fri May 23 19:21:04 1997 *************** *** 74,77 **** --- 74,78 ---- clientdbUpdate(struct in_addr addr, log_type log_type, u_short port) { + int j; char *key; ClientInfo *c; *************** *** 84,91 **** if (c == NULL) debug_trap("clientdbUpdate: Failed to add entry"); ! if (port == Config.Port.http) { ! c->Http.n_requests++; ! c->Http.result_hist[log_type]++; ! } else if (port == Config.Port.icp) { c->Icp.n_requests++; c->Icp.result_hist[log_type]++; --- 85,96 ---- if (c == NULL) debug_trap("clientdbUpdate: Failed to add entry"); ! ! for (j=0;j < Config.Port.number_http; j++) { ! if (port == Config.Port.http[j]) { ! c->Http.n_requests++; ! c->Http.result_hist[log_type]++; ! } ! } ! if (port == Config.Port.icp) { c->Icp.n_requests++; c->Icp.result_hist[log_type]++; diff -c -C2 src//comm.c /var3/src/squid/squid-1.1.10-ltd/src//comm.c *** src//comm.c Fri Apr 25 03:41:12 1997 --- /var3/src/squid/squid-1.1.10-ltd/src//comm.c Fri May 23 19:30:10 1997 *************** *** 636,639 **** --- 636,640 ---- unsigned long N = 0; unsigned long i, nfds; + int j; int dopoll = 0; PF hdl = NULL; *************** *** 643,648 **** if (theOutIcpConnection >= 0) fds[N++] = theOutIcpConnection; ! if (theHttpConnection >= 0 && fdstat_are_n_free_fd(RESERVED_FD)) ! fds[N++] = theHttpConnection; for (i = nfds = 0; i < N; i++) { int events; --- 644,652 ---- if (theOutIcpConnection >= 0) fds[N++] = theOutIcpConnection; ! for (j=0; j < Config.Port.number_http; j++) { ! if (theHttpConnection[j] >= 0 && fdstat_are_n_free_fd(RESERVED_FD)) ! fds[N++] = theHttpConnection[j]; ! } ! for (i = nfds = 0; i < N; i++) { int events; *************** *** 697,705 **** int N = 0; int i = 0; PF hdl = NULL; FD_ZERO(&read_mask); FD_ZERO(&write_mask); ! if (theHttpConnection >= 0 && fdstat_are_n_free_fd(RESERVED_FD)) ! fds[N++] = theHttpConnection; if (theInIcpConnection >= 0) fds[N++] = theInIcpConnection; --- 701,713 ---- int N = 0; int i = 0; + int j; PF hdl = NULL; FD_ZERO(&read_mask); FD_ZERO(&write_mask); ! for (j=0; j < Config.Port.number_http; j++) { ! if (theHttpConnection[j] >= 0 && fdstat_are_n_free_fd(RESERVED_FD)) ! fds[N++] = theHttpConnection[j]; ! } ! if (theInIcpConnection >= 0) fds[N++] = theInIcpConnection; *************** *** 754,757 **** --- 762,767 ---- int fd; int i; + int j; + int continueloop; int maxfd; unsigned long nfds; *************** *** 795,800 **** events |= POLLWRNORM; if (events) { ! if (i == theHttpConnection) ! httpindex = nfds; pfds[nfds].fd = i; pfds[nfds].events = events; --- 805,812 ---- events |= POLLWRNORM; if (events) { ! for (j=0; j < Config.Port.number_http; j++) { ! if (i == theHttpConnection[j]) { ! httpindex = nfds; ! } pfds[nfds].fd = i; pfds[nfds].events = events; *************** *** 864,868 **** if (fd == theOutIcpConnection) continue; ! if (fd == theHttpConnection) continue; if (revents & (POLLRDNORM | POLLIN | POLLHUP | POLLERR)) { --- 876,885 ---- if (fd == theOutIcpConnection) continue; ! continueloop = 0; ! for (j = 0; j < Config.Port.number_http; j++) { ! if (fd == theHttpConnection[j]) ! continueloop = 1; ! } ! if (continueloop) continue; if (revents & (POLLRDNORM | POLLIN | POLLHUP | POLLERR)) { *************** *** 935,938 **** --- 952,957 ---- int fd; int i; + int j; + int continueloop; int maxfd; int nfds; *************** *** 983,989 **** } } ! if (!fdstat_are_n_free_fd(RESERVED_FD) && theHttpConnection >= 0) { ! FD_CLR(theHttpConnection, &readfds); ! } if (shutdown_pending || reread_pending) debug(5, 2, "comm_select: Still waiting on %d FDs\n", nfds); --- 1002,1013 ---- } } ! if (!fdstat_are_n_free_fd(RESERVED_FD)) { ! for (j = 0; j < Config.Port.number_http; j++) { ! if (theHttpConnection[j] >= 0) { ! FD_CLR(theHttpConnection[j], &readfds); ! } ! } ! } ! if (shutdown_pending || reread_pending) debug(5, 2, "comm_select: Still waiting on %d FDs\n", nfds); *************** *** 1037,1042 **** if (fd == theOutIcpConnection) continue; ! if (fd == theHttpConnection) ! continue; if (FD_ISSET(fd, &readfds)) { debug(5, 6, "comm_select: FD %d ready for reading\n", fd); --- 1061,1072 ---- if (fd == theOutIcpConnection) continue; ! continueloop = 0; ! for (j = 0; j < Config.Port.number_http; j++) { ! if (fd == theHttpConnection[j]) ! continueloop = 1; ! } ! if (continueloop) ! continue; ! if (FD_ISSET(fd, &readfds)) { debug(5, 6, "comm_select: FD %d ready for reading\n", fd); diff -c -C2 src//main.c /var3/src/squid/squid-1.1.10-ltd/src//main.c *** src//main.c Fri Apr 25 03:41:16 1997 --- /var3/src/squid/squid-1.1.10-ltd/src//main.c Fri May 23 19:35:51 1997 *************** *** 107,111 **** time_t squid_starttime = 0; ! int theHttpConnection = -1; int theInIcpConnection = -1; int theOutIcpConnection = -1; --- 107,111 ---- time_t squid_starttime = 0; ! int theHttpConnection[MAXHTTPPORTS]; int theInIcpConnection = -1; int theOutIcpConnection = -1; *************** *** 339,361 **** int len; int x; ! enter_suid(); ! theHttpConnection = comm_open(SOCK_STREAM, ! 0, ! Config.Addrs.tcp_incoming, ! Config.Port.http, ! COMM_NONBLOCKING, ! "HTTP Port"); ! leave_suid(); ! if (theHttpConnection < 0) { ! fatal("Cannot open HTTP Port"); } - fd_note(theHttpConnection, "HTTP socket"); - comm_listen(theHttpConnection); - commSetSelect(theHttpConnection, - COMM_SELECT_READ, - asciiHandleConn, - NULL, 0); - debug(1, 1, "Accepting HTTP connections on FD %d.\n", - theHttpConnection); if (!httpd_accel_mode || Config.Accel.withProxy) { --- 339,368 ---- int len; int x; ! int i; ! char fatal_str[BUFSIZ]; ! ! for (i=0; i < Config.Port.number_http; i++) { ! enter_suid(); ! theHttpConnection[i] = comm_open(SOCK_STREAM, ! 0, ! Config.Addrs.tcp_incoming, ! Config.Port.http[i], ! COMM_NONBLOCKING, ! "HTTP Port"); ! leave_suid(); ! if (theHttpConnection[i] < 0) { ! sprintf(fatal_str, "Cannot open HTTP Port #%d (port %d)", ! i, Config.Port.http[i]); ! fatal(fatal_str); ! } ! fd_note(theHttpConnection[i], "HTTP socket"); ! comm_listen(theHttpConnection[i]); ! commSetSelect(theHttpConnection[i], ! COMM_SELECT_READ, ! asciiHandleConn, ! NULL, 0); ! debug(1, 1, "Accepting HTTP connections for port %d on FD %d.\n", ! Config.Port.http[i], theHttpConnection[i]); } if (!httpd_accel_mode || Config.Accel.withProxy) { *************** *** 469,481 **** /* NOTE, this function will be called repeatedly while shutdown * is pending */ ! if (theHttpConnection >= 0) { ! debug(1, 1, "FD %d Closing HTTP connection\n", ! theHttpConnection); ! comm_close(theHttpConnection); ! commSetSelect(theHttpConnection, ! COMM_SELECT_READ, ! NULL, ! NULL, 0); ! theHttpConnection = -1; } if (theInIcpConnection >= 0) { --- 476,492 ---- /* NOTE, this function will be called repeatedly while shutdown * is pending */ ! int i; ! ! for (i=0; i < Config.Port.number_http; i++) { ! if (theHttpConnection[i] >= 0) { ! debug(1, 1, "FD %d Closing HTTP connection %d (port %d)\n", ! theHttpConnection[i],i,Config.Port.http[i]); ! comm_close(theHttpConnection[i]); ! commSetSelect(theHttpConnection[i], ! COMM_SELECT_READ, ! NULL, ! NULL, 0); ! theHttpConnection[i] = -1; ! } } if (theInIcpConnection >= 0) { *************** *** 544,548 **** } if (httpPortNumOverride != 1) ! Config.Port.http = (u_short) httpPortNumOverride; if (icpPortNumOverride != 1) Config.Port.icp = (u_short) icpPortNumOverride; --- 555,559 ---- } if (httpPortNumOverride != 1) ! Config.Port.http[0] = (u_short) httpPortNumOverride; if (icpPortNumOverride != 1) Config.Port.icp = (u_short) icpPortNumOverride; diff -c -C2 src//neighbors.c /var3/src/squid/squid-1.1.10-ltd/src//neighbors.c *** src//neighbors.c Wed Apr 16 09:26:00 1997 --- /var3/src/squid/squid-1.1.10-ltd/src//neighbors.c Fri May 23 19:37:15 1997 *************** *** 834,842 **** { peer *e = NULL; const char *me = getMyHostname(); ! if (!strcmp(host, me) && http_port == Config.Port.http) { ! debug(15, 0, "neighborAdd: skipping cache_host %s %s/%d/%d\n", ! type, host, http_port, icp_port); ! return; } e = xcalloc(1, sizeof(peer)); --- 834,847 ---- { peer *e = NULL; + int j; const char *me = getMyHostname(); ! if (!strcmp(host, me)) { ! for (j=0;j < Config.Port.number_http; j++) { ! if (http_port == Config.Port.http[j]) { ! debug(15, 0, "neighborAdd: skipping cache_host %s %s/%d/%d\n", ! type, host, http_port, icp_port); ! return; ! } ! } } e = xcalloc(1, sizeof(peer)); diff -c -C2 src//send-announce.c /var3/src/squid/squid-1.1.10-ltd/src//send-announce.c *** src//send-announce.c Wed Feb 26 05:24:51 1997 --- /var3/src/squid/squid-1.1.10-ltd/src//send-announce.c Fri May 23 19:37:54 1997 *************** *** 63,69 **** sprintf(tbuf, "cache_version SQUID/%s\n", version_string); strcat(sndbuf, tbuf); sprintf(tbuf, "Running on %s %d %d\n", getMyHostname(), ! Config.Port.http, Config.Port.icp); strcat(sndbuf, tbuf); --- 63,70 ---- sprintf(tbuf, "cache_version SQUID/%s\n", version_string); strcat(sndbuf, tbuf); + /* XXX should actually send all http ports -- ltd */ sprintf(tbuf, "Running on %s %d %d\n", getMyHostname(), ! Config.Port.http[0], Config.Port.icp); strcat(sndbuf, tbuf); diff -c -C2 src//squid.h /var3/src/squid/squid-1.1.10-ltd/src//squid.h *** src//squid.h Fri Apr 25 03:41:17 1997 --- /var3/src/squid/squid-1.1.10-ltd/src//squid.h Fri May 23 19:38:19 1997 *************** *** 316,320 **** extern time_t squid_starttime; /* main.c */ extern int do_reuse; /* main.c */ ! extern int theHttpConnection; /* main.c */ extern int theInIcpConnection; /* main.c */ extern int theOutIcpConnection; /* main.c */ --- 316,320 ---- extern time_t squid_starttime; /* main.c */ extern int do_reuse; /* main.c */ ! extern int theHttpConnection[MAXHTTPPORTS]; /* main.c */ extern int theInIcpConnection; /* main.c */ extern int theOutIcpConnection; /* main.c */ diff -c -C2 src//tools.c /var3/src/squid/squid-1.1.10-ltd/src//tools.c *** src//tools.c Thu Mar 27 17:19:02 1997 --- /var3/src/squid/squid-1.1.10-ltd/src//tools.c Fri May 23 19:38:50 1997 *************** *** 133,139 **** releaseServerSockets(void) { /* Release the main ports as early as possible */ ! if (theHttpConnection >= 0) ! (void) close(theHttpConnection); if (theInIcpConnection >= 0) (void) close(theInIcpConnection); --- 133,144 ---- releaseServerSockets(void) { + int j; + /* Release the main ports as early as possible */ ! for (j = 0; j < Config.Port.number_http; j++) { ! if (theHttpConnection[j] >= 0) ! (void) close(theHttpConnection[j]); ! } ! if (theInIcpConnection >= 0) (void) close(theInIcpConnection);