/*
- * $Id: cache_cf.cc,v 1.358 2000/12/05 06:24:00 wessels Exp $
+ * $Id: cache_cf.cc,v 1.359 2000/12/05 08:55:47 wessels Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
char *token = NULL;
peer *p;
int i;
- sockaddr_in_list *s;
- const char *me = getMyHostname();
p = memAllocate(MEM_PEER);
p->http_port = CACHE_HTTP_PORT;
p->icp.port = CACHE_ICP_PORT;
p->http_port = (u_short) i;
i = GetInteger();
p->icp.port = (u_short) i;
- if (strcmp(p->host, me) == 0) {
- for (s = Config.Sockaddr.http; s; s = s->next) {
- if (p->http_port != ntohs(s->s.sin_port))
- continue;
- debug(15, 1) ("parse_peer: Peer looks like myself: Ignoring %s %s/%d/%d\n",
- neighborTypeStr(p), p->host, p->http_port, p->icp.port);
- xfree(p->host);
- memFree(p, MEM_PEER);
- return;
- }
- }
while ((token = strtok(NULL, w_space))) {
if (!strcasecmp(token, "proxy-only")) {
p->options.proxy_only = 1;
/*
- * $Id: neighbors.cc,v 1.289 2000/12/05 06:24:00 wessels Exp $
+ * $Id: neighbors.cc,v 1.290 2000/12/05 08:55:47 wessels Exp $
*
* DEBUG: section 15 Neighbor Routines
* AUTHOR: Harvest Derived
struct sockaddr_in name;
socklen_t len = sizeof(struct sockaddr_in);
struct servent *sep = NULL;
+ const char *me = getMyHostname();
+ peer *this;
+ peer *next;
memset(&name, '\0', sizeof(struct sockaddr_in));
if (getsockname(fd, (struct sockaddr *) &name, &len) < 0)
debug(15, 1) ("getsockname(%d,%p,%p) failed.\n", fd, &name, &len);
+ for (this = Config.peers; this; this = next) {
+ sockaddr_in_list *s;
+ next = this->next;
+ if (0 != strcmp(this->host, me))
+ continue;
+ for (s = Config.Sockaddr.http; s; s = s->next) {
+ if (this->http_port != ntohs(s->s.sin_port))
+ continue;
+ debug(15, 1) ("WARNING: Peer looks like this host\n");
+ debug(15, 1) (" Ignoring %s %s/%d/%d\n",
+ neighborTypeStr(this), this->host, this->http_port,
+ this->icp.port);
+ neighborRemove(this);
+ }
+ }
+
peerRefreshDNS((void *) 1);
if (0 == echo_hdr.opcode) {
echo_hdr.opcode = ICP_SECHO;