From: wessels <> Date: Thu, 1 May 1997 02:06:23 +0000 (+0000) Subject: Change ipcache_unregister. X-Git-Tag: SQUID_3_0_PRE1~5032 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b69f77712971b79d53eda97ef3b841a04a240573;p=thirdparty%2Fsquid.git Change ipcache_unregister. Old: ipcache_unregister(host, fd) New: ipcacheUnregister(host, void *callback_data) Same for fqdncacheUnregister(). Track ip/fqdn pending lookups in ACL code neighbors.c: s/peer *e/peer *p/g --- diff --git a/src/acl.cc b/src/acl.cc index e22e1a58e9..fd2ac7f9cf 100644 --- a/src/acl.cc +++ b/src/acl.cc @@ -1,5 +1,5 @@ /* - * $Id: acl.cc,v 1.91 1997/04/28 04:22:56 wessels Exp $ + * $Id: acl.cc,v 1.92 1997/04/30 20:06:23 wessels Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -60,7 +60,7 @@ static int decode_addr _PARAMS((const char *, struct in_addr *, struct in_addr * static void aclCheck _PARAMS((aclCheck_t * checklist)); static void aclCheckCallback _PARAMS((aclCheck_t * checklist, int answer)); -static void aclLookupDstIPDone _PARAMS((int fd, const ipcache_addrs * ia, void *data)); +static IPH aclLookupDstIPDone; static void aclLookupSrcFQDNDone _PARAMS((int fd, const char *fqdn, void *data)); static void aclLookupDstFQDNDone _PARAMS((int fd, const char *fqdn, void *data)); @@ -1167,7 +1167,6 @@ aclCheck(aclCheck_t * checklist) { int allow = 0; const struct _acl_access *A; - ipcache_addrs *ia = NULL; int match; while ((A = checklist->access_list)) { debug(28, 3, "aclCheck: checking '%s'\n", A->cfgline); @@ -1179,6 +1178,7 @@ aclCheck(aclCheck_t * checklist) -1, aclLookupDstIPDone, checklist); + checklist->dst_ip_lookup_pending = 1; return; } else if (checklist->state[ACL_SRC_DOMAIN] == ACL_LOOKUP_NEED) { checklist->state[ACL_SRC_DOMAIN] = ACL_LOOKUP_PENDING; @@ -1186,14 +1186,17 @@ aclCheck(aclCheck_t * checklist) -1, aclLookupSrcFQDNDone, checklist); + checklist->src_fqdn_lookup_pending = 1; return; } else if (checklist->state[ACL_DST_DOMAIN] == ACL_LOOKUP_NEED) { - if ((ia = ipcacheCheckNumeric(checklist->request->host)) != NULL) { + checklist->dst_ia = ipcacheCheckNumeric(checklist->request->host); + if (checklist->dst_ia != NULL) { checklist->state[ACL_DST_DOMAIN] = ACL_LOOKUP_PENDING; - fqdncache_nbgethostbyaddr(ia->in_addrs[0], + fqdncache_nbgethostbyaddr(checklist->dst_ia->in_addrs[0], -1, aclLookupDstFQDNDone, checklist); + checklist->dst_fqdn_lookup_pending = 1; } else { checklist->state[ACL_DST_DOMAIN] = ACL_LOOKUP_DONE; } @@ -1216,6 +1219,12 @@ aclCheckCallback(aclCheck_t * checklist, int answer) { debug(28, 3, "aclCheckCallback: answer=%d\n", answer); checklist->callback(answer, checklist->callback_data); + if (checklist->src_fqdn_lookup_pending) + fqdncacheUnregister(checklist->src_addr, checklist); + if (checklist->dst_fqdn_lookup_pending) + fqdncacheUnregister(checklist->dst_ia->in_addrs[0], checklist); + if (checklist->dst_ip_lookup_pending) + ipcacheUnregister(checklist->request->host, checklist); requestUnlink(checklist->request); xfree(checklist); } @@ -1224,6 +1233,7 @@ static void aclLookupDstIPDone(int fd, const ipcache_addrs * ia, void *data) { aclCheck_t *checklist = data; + checklist->dst_ip_lookup_pending = 0; checklist->state[ACL_DST_IP] = ACL_LOOKUP_DONE; aclCheck(checklist); } @@ -1232,6 +1242,7 @@ static void aclLookupSrcFQDNDone(int fd, const char *fqdn, void *data) { aclCheck_t *checklist = data; + checklist->src_fqdn_lookup_pending = 0; checklist->state[ACL_SRC_DOMAIN] = ACL_LOOKUP_DONE; aclCheck(checklist); } @@ -1240,6 +1251,7 @@ static void aclLookupDstFQDNDone(int fd, const char *fqdn, void *data) { aclCheck_t *checklist = data; + checklist->dst_fqdn_lookup_pending = 0; checklist->state[ACL_SRC_DOMAIN] = ACL_LOOKUP_DONE; aclCheck(checklist); } diff --git a/src/comm.cc b/src/comm.cc index 59d85ff0a4..67f0fc57d3 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.147 1997/04/30 18:33:22 wessels Exp $ + * $Id: comm.cc,v 1.148 1997/04/30 20:06:25 wessels Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -1379,6 +1379,7 @@ commHandleWrite(int fd, void *data) nleft = state->size - state->offset; len = write(fd, state->buf + state->offset, nleft); + fd_bytes(fd, len, FD_WRITE); if (len == 0) { /* Note we even call write if nleft == 0 */ diff --git a/src/disk.cc b/src/disk.cc index 801ade6939..97562e7a8c 100644 --- a/src/disk.cc +++ b/src/disk.cc @@ -1,5 +1,5 @@ /* - * $Id: disk.cc,v 1.64 1997/04/30 18:30:46 wessels Exp $ + * $Id: disk.cc,v 1.65 1997/04/30 20:06:26 wessels Exp $ * * DEBUG: section 6 Disk I/O Routines * AUTHOR: Harvest Derived @@ -317,15 +317,15 @@ diskHandleWrite(int fd, void *unused) } static int -diskHandleWriteComplete(void *data, int retcode, int errcode) +diskHandleWriteComplete(void *data, int len, int errcode) { disk_ctrl_t *ctrlp = data; int fd = ctrlp->fd; FD_ENTRY *fde = &fd_table[fd]; dwrite_q *q = fde->disk.write_q; - int len = retcode; errno = errcode; safe_free(data); + fd_bytes(fd, len, FD_WRITE); if (q == NULL) /* Someone aborted and then the write */ return DISK_ERROR; /* completed anyway. :( */ BIT_SET(fde->flags, FD_AT_EOF); diff --git a/src/fqdncache.cc b/src/fqdncache.cc index 72f073fc35..341c3b95fc 100644 --- a/src/fqdncache.cc +++ b/src/fqdncache.cc @@ -1,6 +1,6 @@ /* - * $Id: fqdncache.cc,v 1.50 1997/04/30 18:30:50 wessels Exp $ + * $Id: fqdncache.cc,v 1.51 1997/04/30 20:06:26 wessels Exp $ * * DEBUG: section 35 FQDN Cache * AUTHOR: Harvest Derived @@ -740,26 +740,27 @@ fqdncache_init(void) /* clean up the pending entries in dnsserver */ /* return 1 if we found the host, 0 otherwise */ int -fqdncacheUnregister(struct in_addr addr, int fd) +fqdncacheUnregister(struct in_addr addr, void *data) { char *name = inet_ntoa(addr); fqdncache_entry *f = NULL; struct _fqdn_pending *p = NULL; int n = 0; - - debug(35, 3, "fqdncache_unregister: FD %d, name '%s'\n", fd, name); + debug(35, 3, "fqdncacheUnregister: FD %d, name '%s'\n", name); if ((f = fqdncache_get(name)) == NULL) return 0; if (f->status == FQDN_PENDING || f->status == FQDN_DISPATCHED) { for (p = f->pending_head; p; p = p->next) { - if (p->fd == fd && p->handler != NULL) { - p->handler = NULL; - p->fd = -1; - n++; - } + if (p->handlerData != data) + continue; + p->handler = NULL; + p->fd = -1; + n++; } } - debug(35, 3, "fqdncache_unregister: unregistered %d handlers\n", n); + if (n == 0) + debug_trap("fqdncacheUnregister: callback data not found"); + debug(35, 3, "fqdncacheUnregister: unregistered %d handlers\n", n); return n; } diff --git a/src/http.cc b/src/http.cc index e8c46784ff..08bef47ad1 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,5 +1,5 @@ /* - * $Id: http.cc,v 1.157 1997/04/30 18:30:53 wessels Exp $ + * $Id: http.cc,v 1.158 1997/04/30 20:06:28 wessels Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -223,7 +223,7 @@ static void httpSendComplete _PARAMS((int fd, char *, int, int, void *)); static void proxyhttpStartComplete _PARAMS((void *, int)); static void httpStartComplete _PARAMS((void *, int)); static void httpSendRequest _PARAMS((int fd, void *)); -static void httpConnect _PARAMS((int fd, const ipcache_addrs *, void *)); +static IPH httpConnect; static void httpConnectDone _PARAMS((int fd, int status, void *data)); static void httpAppendRequestHeader _PARAMS((char *hdr, const char *line, size_t * sz, size_t max)); @@ -240,7 +240,7 @@ httpStateFree(int fd, void *data) httpState->reply_hdr = NULL; } if (httpState->ip_lookup_pending) - ipcache_unregister(httpState->request->host, httpState->fd); + ipcacheUnregister(httpState->request->host, httpState); requestUnlink(httpState->request); requestUnlink(httpState->orig_request); xfree(httpState); diff --git a/src/ipcache.cc b/src/ipcache.cc index f3b68b3e77..df28a733c4 100644 --- a/src/ipcache.cc +++ b/src/ipcache.cc @@ -1,6 +1,6 @@ /* - * $Id: ipcache.cc,v 1.112 1997/04/30 18:30:56 wessels Exp $ + * $Id: ipcache.cc,v 1.113 1997/04/30 20:06:31 wessels Exp $ * * DEBUG: section 14 IP Cache * AUTHOR: Harvest Derived @@ -771,25 +771,26 @@ ipcache_init(void) /* clean up the pending entries in dnsserver */ /* return 1 if we found the host, 0 otherwise */ int -ipcache_unregister(const char *name, int fd) +ipcacheUnregister(const char *name, void *data) { ipcache_entry *i = NULL; struct _ip_pending *p = NULL; int n = 0; - - debug(14, 3, "ipcache_unregister: FD %d, name '%s'\n", fd, name); + debug(14, 3, "ipcacheUnregister: FD %d, name '%s'\n", name); if ((i = ipcache_get(name)) == NULL) return 0; if (i->status == IP_PENDING || i->status == IP_DISPATCHED) { for (p = i->pending_head; p; p = p->next) { - if (p->fd == fd && p->handler != NULL) { - p->handler = NULL; - p->fd = -1; - n++; - } + if (p->handlerData != data) + continue; + p->handler = NULL; + p->fd = -1; + n++; } } - debug(14, 3, "ipcache_unregister: unregistered %d handlers\n", n); + if (n == 0) + debug_trap("ipcacheUnregister: callback data not found"); + debug(14, 3, "ipcacheUnregister: unregistered %d handlers\n", n); return n; } diff --git a/src/neighbors.cc b/src/neighbors.cc index 59ca107155..29ccb7c471 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -1,5 +1,5 @@ /* - * $Id: neighbors.cc,v 1.135 1997/04/30 18:30:57 wessels Exp $ + * $Id: neighbors.cc,v 1.136 1997/04/30 20:06:32 wessels Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -114,12 +114,12 @@ static int peerWouldBePinged _PARAMS((const peer *, request_t *)); static void neighborRemove _PARAMS((peer *)); static peer *whichPeer _PARAMS((const struct sockaddr_in * from)); static void neighborAlive _PARAMS((peer *, const MemObject *, const icp_common_t *)); -static void neighborCountIgnored _PARAMS((peer * e, icp_opcode op_unused)); +static void neighborCountIgnored _PARAMS((peer *, icp_opcode op_unused)); static peer_t parseNeighborType _PARAMS((const char *s)); static void peerRefreshDNS _PARAMS((void *)); -static void peerDNSConfigure _PARAMS((int fd, const ipcache_addrs * ia, void *data)); +static IPH peerDNSConfigure; static void peerCheckConnect _PARAMS((void *)); -static void peerCheckConnect2 _PARAMS((int, const ipcache_addrs *, void *)); +static IPH peerCheckConnect2; static void peerCheckConnectDone _PARAMS((int, int, void *)); static void peerCountMcastPeersDone _PARAMS((void *data)); static void peerCountMcastPeersStart _PARAMS((void *data)); @@ -143,11 +143,11 @@ static struct { }; char * -neighborTypeStr(const peer * e) +neighborTypeStr(const peer * p) { - if (e->type == PEER_SIBLING) + if (p->type == PEER_SIBLING) return "Sibling"; - if (e->type == PEER_MULTICAST) + if (p->type == PEER_MULTICAST) return "Multicast Group"; return "Parent"; } @@ -159,12 +159,12 @@ whichPeer(const struct sockaddr_in *from) int j; u_short port = ntohs(from->sin_port); struct in_addr ip = from->sin_addr; - peer *e = NULL; + peer *p = NULL; debug(15, 3, "whichPeer: from %s port %d\n", inet_ntoa(ip), port); - for (e = Peers.peers_head; e; e = e->next) { - for (j = 0; j < e->n_addresses; j++) { - if (ip.s_addr == e->addresses[j].s_addr && port == e->icp_port) { - return e; + for (p = Peers.peers_head; p; p = p->next) { + for (j = 0; j < p->n_addresses; j++) { + if (ip.s_addr == p->addresses[j].s_addr && port == p->icp_port) { + return p; } } } @@ -187,15 +187,15 @@ hierarchyNote(request_t * request, } static peer_t -neighborType(const peer * e, const request_t * request) +neighborType(const peer * p, const request_t * request) { const struct _domain_type *d = NULL; - for (d = e->typelist; d; d = d->next) { + for (d = p->typelist; d; d = d->next) { if (matchDomainName(d->domain, request->host)) if (d->type != PEER_NONE) return d->type; } - return e->type; + return p->type; } /* @@ -205,7 +205,7 @@ neighborType(const peer * e, const request_t * request) * from PEER. */ static int -peerAllowedToUse(const peer * e, request_t * request) +peerAllowedToUse(const peer * p, request_t * request) { const struct _domain_ping *d = NULL; int do_ping = 1; @@ -214,22 +214,22 @@ peerAllowedToUse(const peer * e, request_t * request) if (request == NULL) fatal_dump("peerAllowedToUse: NULL request"); if (BIT_TEST(request->flags, REQ_NOCACHE)) - if (neighborType(e, request) == PEER_SIBLING) + if (neighborType(p, request) == PEER_SIBLING) return 0; if (BIT_TEST(request->flags, REQ_REFRESH)) - if (neighborType(e, request) == PEER_SIBLING) + if (neighborType(p, request) == PEER_SIBLING) return 0; - if (e->pinglist == NULL && e->acls == NULL) + if (p->pinglist == NULL && p->acls == NULL) return do_ping; do_ping = 0; - for (d = e->pinglist; d; d = d->next) { + for (d = p->pinglist; d; d = d->next) { if (matchDomainName(d->domain, request->host)) return d->do_ping; do_ping = !d->do_ping; } checklist.src_addr = request->client_addr; checklist.request = request; - for (a = e->acls; a; a = a->next) { + for (a = p->acls; a; a = a->next) { if (aclMatchAcl(a->acl, &checklist)) return a->op; do_ping = !a->op; @@ -239,34 +239,34 @@ peerAllowedToUse(const peer * e, request_t * request) /* Return TRUE if it is okay to send an ICP request to this peer. */ static int -peerWouldBePinged(const peer * e, request_t * request) +peerWouldBePinged(const peer * p, request_t * request) { - if (!peerAllowedToUse(e, request)) + if (!peerAllowedToUse(p, request)) return 0; - if (e->options & NEIGHBOR_NO_QUERY) + if (p->options & NEIGHBOR_NO_QUERY) return 0; - if (e->options & NEIGHBOR_MCAST_RESPONDER) + if (p->options & NEIGHBOR_MCAST_RESPONDER) return 0; /* the case below seems strange, but can happen if the * URL host is on the other side of a firewall */ - if (e->type == PEER_SIBLING) + if (p->type == PEER_SIBLING) if (!BIT_TEST(request->flags, REQ_HIERARCHICAL)) return 0; - if (e->icp_port == echo_port) - if (!neighborUp(e)) + if (p->icp_port == echo_port) + if (!neighborUp(p)) return 0; - if (e->n_addresses == 0) + if (p->n_addresses == 0) return 0; return 1; } /* Return TRUE if it is okay to send an HTTP request to this peer. */ static int -peerHTTPOkay(const peer * e, request_t * request) +peerHTTPOkay(const peer * p, request_t * request) { - if (!peerAllowedToUse(e, request)) + if (!peerAllowedToUse(p, request)) return 0; - if (!neighborUp(e)) + if (!neighborUp(p)) return 0; return 1; } @@ -274,10 +274,10 @@ peerHTTPOkay(const peer * e, request_t * request) int neighborsCount(request_t * request) { - peer *e = NULL; + peer *p = NULL; int count = 0; - for (e = Peers.peers_head; e; e = e->next) - if (peerWouldBePinged(e, request)) + for (p = Peers.peers_head; p; p = p->next) + if (peerWouldBePinged(p, request)) count++; debug(15, 3, "neighborsCount: %d\n", count); return count; @@ -287,15 +287,15 @@ peer * getSingleParent(request_t * request) { peer *p = NULL; - peer *e = NULL; - for (e = Peers.peers_head; e; e = e->next) { - if (!peerHTTPOkay(e, request)) + peer *q = NULL; + for (q = Peers.peers_head; q; q = q->next) { + if (!peerHTTPOkay(q, request)) continue; - if (neighborType(e, request) != PEER_PARENT) + if (neighborType(q, request) != PEER_PARENT) return NULL; /* oops, found SIBLING */ if (p) return NULL; /* oops, found second parent */ - p = e; + p = q; } debug(15, 3, "getSingleParent: returning %s\n", p ? p->host : "NULL"); return p; @@ -304,63 +304,63 @@ getSingleParent(request_t * request) peer * getFirstUpParent(request_t * request) { - peer *e = NULL; - for (e = Peers.peers_head; e; e = e->next) { - if (!neighborUp(e)) + peer *p = NULL; + for (p = Peers.peers_head; p; p = p->next) { + if (!neighborUp(p)) continue; - if (neighborType(e, request) != PEER_PARENT) + if (neighborType(p, request) != PEER_PARENT) continue; - if (!peerHTTPOkay(e, request)) + if (!peerHTTPOkay(p, request)) continue; break; } - debug(15, 3, "getFirstUpParent: returning %s\n", e ? e->host : "NULL"); - return e; + debug(15, 3, "getFirstUpParent: returning %s\n", p ? p->host : "NULL"); + return p; } peer * getRoundRobinParent(request_t * request) { - peer *e; - peer *f = NULL; - for (e = Peers.peers_head; e; e = e->next) { - if (!BIT_TEST(e->options, NEIGHBOR_ROUNDROBIN)) + peer *p; + peer *q = NULL; + for (p = Peers.peers_head; p; p = p->next) { + if (!BIT_TEST(p->options, NEIGHBOR_ROUNDROBIN)) continue; - if (neighborType(e, request) != PEER_PARENT) + if (neighborType(p, request) != PEER_PARENT) continue; - if (!peerHTTPOkay(e, request)) + if (!peerHTTPOkay(p, request)) continue; - if (f && f->rr_count < e->rr_count) + if (q && q->rr_count < p->rr_count) continue; - f = e; + q = p; } - if (f) - f->rr_count++; - debug(15, 3, "getRoundRobinParent: returning %s\n", e ? e->host : "NULL"); - return f; + if (q) + q->rr_count++; + debug(15, 3, "getRoundRobinParent: returning %s\n", q ? q->host : "NULL"); + return q; } peer * getDefaultParent(request_t * request) { - peer *e = NULL; - for (e = Peers.peers_head; e; e = e->next) { - if (neighborType(e, request) != PEER_PARENT) + peer *p = NULL; + for (p = Peers.peers_head; p; p = p->next) { + if (neighborType(p, request) != PEER_PARENT) continue; - if (!BIT_TEST(e->options, NEIGHBOR_DEFAULT_PARENT)) + if (!BIT_TEST(p->options, NEIGHBOR_DEFAULT_PARENT)) continue; - if (!peerHTTPOkay(e, request)) + if (!peerHTTPOkay(p, request)) continue; - debug(15, 3, "getDefaultParent: returning %s\n", e->host); - return e; + debug(15, 3, "getDefaultParent: returning %s\n", p->host); + return p; } return NULL; } peer * -getNextPeer(peer * e) +getNextPeer(peer * p) { - return e->next; + return p->next; } peer * @@ -372,21 +372,21 @@ getFirstPeer(void) static void neighborRemove(peer * target) { - peer *e = NULL; - peer **E = NULL; - e = Peers.peers_head; - E = &Peers.peers_head; - while (e) { - if (target == e) + peer *p = NULL; + peer **P = NULL; + p = Peers.peers_head; + P = &Peers.peers_head; + while (p) { + if (target == p) break; - E = &e->next; - e = e->next; + P = &p->next; + p = p->next; } - if (e) { - *E = e->next; - e->next = Peers.removed; - Peers.removed = e; - e->stats.ack_deficit = HIER_MAX_DEFICIT; + if (p) { + *P = p->next; + p->next = Peers.removed; + Peers.removed = p; + p->stats.ack_deficit = HIER_MAX_DEFICIT; Peers.n--; } Peers.first_ping = Peers.peers_head; @@ -395,19 +395,19 @@ neighborRemove(peer * target) void neighborsDestroy(void) { - peer *e = NULL; + peer *p = NULL; peer *next = NULL; debug(15, 3, "neighborsDestroy: called\n"); - for (e = Peers.peers_head; e; e = next) { - next = e->next; - peerDestroy(e); + for (p = Peers.peers_head; p; p = next) { + next = p->next; + peerDestroy(p); Peers.n--; } - for (e = Peers.removed; e; e = next) { - next = e->next; - peerDestroy(e); + for (p = Peers.removed; p; p = next) { + next = p->next; + peerDestroy(p); } memset(&Peers, '\0', sizeof(Peers)); } @@ -448,7 +448,7 @@ neighborsUdpPing(request_t * request, MemObject *mem = entry->mem_obj; const ipcache_addrs *ia = NULL; struct sockaddr_in to_addr; - peer *e = NULL; + peer *p = NULL; int i; int reqnum = 0; int flags; @@ -472,27 +472,27 @@ neighborsUdpPing(request_t * request, mem->start_ping = current_time; mem->icp_reply_callback = callback; mem->ircb_data = callback_data; - for (i = 0, e = Peers.first_ping; i++ < Peers.n; e = e->next) { - if (e == NULL) - e = Peers.peers_head; - debug(15, 5, "neighborsUdpPing: Peer %s\n", e->host); - if (!peerWouldBePinged(e, request)) + for (i = 0, p = Peers.first_ping; i++ < Peers.n; p = p->next) { + if (p == NULL) + p = Peers.peers_head; + debug(15, 5, "neighborsUdpPing: Peer %s\n", p->host); + if (!peerWouldBePinged(p, request)) continue; /* next peer */ peers_pinged++; debug(15, 4, "neighborsUdpPing: pinging peer %s for '%s'\n", - e->host, url); - if (e->type == PEER_MULTICAST) - comm_set_mcast_ttl(theOutIcpConnection, e->mcast.ttl); + p->host, url); + if (p->type == PEER_MULTICAST) + comm_set_mcast_ttl(theOutIcpConnection, p->mcast.ttl); reqnum = storeReqnum(entry, request->method); debug(15, 3, "neighborsUdpPing: key = '%s'\n", entry->key); debug(15, 3, "neighborsUdpPing: reqnum = %d\n", reqnum); - if (e->icp_port == echo_port) { + if (p->icp_port == echo_port) { debug(15, 4, "neighborsUdpPing: Looks like a dumb cache, send DECHO ping\n"); echo_hdr.reqnum = reqnum; query = icpCreateMessage(ICP_OP_DECHO, 0, url, reqnum, 0); icpUdpSend(theOutIcpConnection, - &e->in_addr, + &p->in_addr, query, LOG_TAG_NONE, PROTO_NONE); @@ -501,37 +501,37 @@ neighborsUdpPing(request_t * request, /* check if we should set ICP_FLAG_HIT_OBJ */ if (opt_udp_hit_obj) if (!BIT_TEST(request->flags, REQ_NOCACHE)) - if (e->icp_version == ICP_VERSION_2) + if (p->icp_version == ICP_VERSION_2) flags |= ICP_FLAG_HIT_OBJ; if (Config.Options.query_icmp) - if (e->icp_version == ICP_VERSION_2) + if (p->icp_version == ICP_VERSION_2) flags |= ICP_FLAG_SRC_RTT; query = icpCreateMessage(ICP_OP_QUERY, flags, url, reqnum, 0); icpUdpSend(theOutIcpConnection, - &e->in_addr, + &p->in_addr, query, LOG_TAG_NONE, PROTO_NONE); } queries_sent++; - e->stats.ack_deficit++; - e->stats.pings_sent++; + p->stats.ack_deficit++; + p->stats.pings_sent++; debug(15, 3, "neighborsUdpPing: %s: ack_deficit = %d\n", - e->host, e->stats.ack_deficit); - if (e->type == PEER_MULTICAST) { - e->stats.ack_deficit = 0; - (*exprep) += e->mcast.n_replies_expected; - } else if (neighborUp(e)) { + p->host, p->stats.ack_deficit); + if (p->type == PEER_MULTICAST) { + p->stats.ack_deficit = 0; + (*exprep) += p->mcast.n_replies_expected; + } else if (neighborUp(p)) { /* its alive, expect a reply from it */ (*exprep)++; } else { /* Neighbor is dead; ping it anyway, but don't expect a reply */ /* log it once at the threshold */ - if ((e->stats.ack_deficit == HIER_MAX_DEFICIT)) { + if ((p->stats.ack_deficit == HIER_MAX_DEFICIT)) { debug(15, 0, "Detected DEAD %s: %s/%d/%d\n", - neighborTypeStr(e), - e->host, e->http_port, e->icp_port); + neighborTypeStr(p), + p->host, p->http_port, p->icp_port); } } } @@ -572,35 +572,35 @@ neighborsUdpPing(request_t * request, } static void -neighborAlive(peer * e, const MemObject * mem, const icp_common_t * header) +neighborAlive(peer * p, const MemObject * mem, const icp_common_t * header) { int rtt; int n; /* Neighbor is alive, reset the ack deficit */ - if (e->stats.ack_deficit >= HIER_MAX_DEFICIT) { + if (p->stats.ack_deficit >= HIER_MAX_DEFICIT) { debug(15, 0, "Detected REVIVED %s: %s/%d/%d\n", - neighborTypeStr(e), - e->host, e->http_port, e->icp_port); + neighborTypeStr(p), + p->host, p->http_port, p->icp_port); } - e->stats.ack_deficit = 0; - n = ++e->stats.pings_acked; + p->stats.ack_deficit = 0; + n = ++p->stats.pings_acked; if ((icp_opcode) header->opcode <= ICP_OP_END) - e->stats.counts[header->opcode]++; + p->stats.counts[header->opcode]++; if (n > RTT_AV_FACTOR) n = RTT_AV_FACTOR; if (mem) { rtt = tvSubMsec(mem->start_ping, current_time); - e->stats.rtt = (e->stats.rtt * (n - 1) + rtt) / n; - e->icp_version = (int) header->version; + p->stats.rtt = (p->stats.rtt * (n - 1) + rtt) / n; + p->icp_version = (int) header->version; } } static void -neighborCountIgnored(peer * e, icp_opcode op_unused) +neighborCountIgnored(peer * p, icp_opcode op_unused) { - if (e == NULL) + if (p == NULL) return; - e->stats.ignored_replies++; + p->stats.ignored_replies++; NLateReplies++; } @@ -611,13 +611,13 @@ neighborCountIgnored(peer * e, icp_opcode op_unused) * from being used */ static int -ignoreMulticastReply(peer * e, MemObject * mem) +ignoreMulticastReply(peer * p, MemObject * mem) { - if (e == NULL) + if (p == NULL) return 0; - if (!BIT_TEST(e->options, NEIGHBOR_MCAST_RESPONDER)) + if (!BIT_TEST(p->options, NEIGHBOR_MCAST_RESPONDER)) return 0; - if (peerHTTPOkay(e, mem->request)) + if (peerHTTPOkay(p, mem->request)) return 0; return 1; } @@ -631,50 +631,50 @@ ignoreMulticastReply(peer * e, MemObject * mem) void neighborsUdpAck(int fd, const char *url, icp_common_t * header, const struct sockaddr_in *from, StoreEntry * entry, char *data, int data_sz) { - peer *e = NULL; + peer *p = NULL; MemObject *mem = entry->mem_obj; peer_t ntype = PEER_NONE; char *opcode_d; icp_opcode opcode = (icp_opcode) header->opcode; debug(15, 6, "neighborsUdpAck: opcode %d '%s'\n", (int) opcode, url); - if ((e = whichPeer(from))) - neighborAlive(e, mem, header); + if ((p = whichPeer(from))) + neighborAlive(p, mem, header); if (opcode > ICP_OP_END) return; opcode_d = IcpOpcodeStr[opcode]; /* check if someone is already fetching it */ if (BIT_TEST(entry->flag, ENTRY_DISPATCHED)) { debug(15, 3, "neighborsUdpAck: '%s' already being fetched.\n", url); - neighborCountIgnored(e, opcode); + neighborCountIgnored(p, opcode); return; } if (mem == NULL) { debug(15, 2, "Ignoring %s for missing mem_obj: %s\n", opcode_d, url); - neighborCountIgnored(e, opcode); + neighborCountIgnored(p, opcode); return; } if (entry->ping_status != PING_WAITING) { debug(15, 2, "neighborsUdpAck: Unexpected %s for %s\n", opcode_d, url); - neighborCountIgnored(e, opcode); + neighborCountIgnored(p, opcode); return; } if (entry->lock_count == 0) { debug(12, 1, "neighborsUdpAck: '%s' has no locks\n", url); - neighborCountIgnored(e, opcode); + neighborCountIgnored(p, opcode); return; } debug(15, 3, "neighborsUdpAck: %s for '%s' from %s \n", - opcode_d, url, e ? e->host : "source"); - if (e) - ntype = neighborType(e, mem->request); - if (ignoreMulticastReply(e, mem)) { - neighborCountIgnored(e, opcode); + opcode_d, url, p ? p->host : "source"); + if (p) + ntype = neighborType(p, mem->request); + if (ignoreMulticastReply(p, mem)) { + neighborCountIgnored(p, opcode); } else if (opcode == ICP_OP_SECHO) { /* Received source-ping reply */ - if (e) { - debug(15, 1, "Ignoring SECHO from neighbor %s\n", e->host); - neighborCountIgnored(e, opcode); + if (p) { + debug(15, 1, "Ignoring SECHO from neighbor %s\n", p->host); + neighborCountIgnored(p, opcode); } else { /* if we reach here, source-ping reply is the first 'parent', * so fetch directly from the source */ @@ -682,56 +682,56 @@ neighborsUdpAck(int fd, const char *url, icp_common_t * header, const struct soc mem->icp_reply_callback(NULL, ntype, opcode, mem->ircb_data); } } else if (opcode == ICP_OP_MISS) { - if (e == NULL) { + if (p == NULL) { debug(15, 1, "Ignoring MISS from non-peer %s\n", inet_ntoa(from->sin_addr)); } else if (ntype != PEER_PARENT) { (void) 0; /* ignore MISS from non-parent */ } else { - mem->icp_reply_callback(e, ntype, opcode, mem->ircb_data); + mem->icp_reply_callback(p, ntype, opcode, mem->ircb_data); } } else if (opcode == ICP_OP_HIT || opcode == ICP_OP_HIT_OBJ) { - if (e == NULL) { + if (p == NULL) { debug(15, 1, "Ignoring HIT from non-peer %s\n", inet_ntoa(from->sin_addr)); } else { - mem->icp_reply_callback(e, ntype, ICP_OP_HIT, mem->ircb_data); + mem->icp_reply_callback(p, ntype, ICP_OP_HIT, mem->ircb_data); } } else if (opcode == ICP_OP_DECHO) { - if (e == NULL) { + if (p == NULL) { debug(15, 1, "Ignoring DECHO from non-peer %s\n", inet_ntoa(from->sin_addr)); } else if (ntype == PEER_SIBLING) { debug_trap("neighborsUdpAck: Found non-ICP cache as SIBLING\n"); debug_trap("neighborsUdpAck: non-ICP neighbors must be a PARENT\n"); } else { - mem->icp_reply_callback(e, ntype, opcode, mem->ircb_data); + mem->icp_reply_callback(p, ntype, opcode, mem->ircb_data); } } else if (opcode == ICP_OP_SECHO) { - if (e) { - debug(15, 1, "Ignoring SECHO from neighbor %s\n", e->host); - neighborCountIgnored(e, opcode); + if (p) { + debug(15, 1, "Ignoring SECHO from neighbor %s\n", p->host); + neighborCountIgnored(p, opcode); } else if (!Config.sourcePing) { debug(15, 1, "Unsolicited SECHO from %s\n", inet_ntoa(from->sin_addr)); } else { mem->icp_reply_callback(NULL, ntype, opcode, mem->ircb_data); } } else if (opcode == ICP_OP_DENIED) { - if (e == NULL) { + if (p == NULL) { debug(15, 1, "Ignoring DENIED from non-peer %s\n", inet_ntoa(from->sin_addr)); - } else if (e->stats.pings_acked > 100) { - if (100 * e->stats.counts[ICP_OP_DENIED] / e->stats.pings_acked > 95) { - debug(15, 0, "95%% of replies from '%s' are UDP_DENIED\n", e->host); - debug(15, 0, "Disabling '%s', please check your configuration.\n", e->host); - neighborRemove(e); - e = NULL; + } else if (p->stats.pings_acked > 100) { + if (100 * p->stats.counts[ICP_OP_DENIED] / p->stats.pings_acked > 95) { + debug(15, 0, "95%% of replies from '%s' are UDP_DENIED\n", p->host); + debug(15, 0, "Disabling '%s', please check your configuration.\n", p->host); + neighborRemove(p); + p = NULL; } else { - neighborCountIgnored(e, opcode); + neighborCountIgnored(p, opcode); } } } else if (opcode == ICP_OP_MISS_NOFETCH) { - mem->icp_reply_callback(e, ntype, opcode, mem->ircb_data); + mem->icp_reply_callback(p, ntype, opcode, mem->ircb_data); } else { debug(15, 0, "neighborsUdpAck: Unexpected ICP reply: %s\n", opcode_d); } @@ -746,36 +746,36 @@ neighborAdd(const char *host, int weight, int mcast_ttl) { - peer *e = NULL; + peer *p = 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)); - e->http_port = http_port; - e->icp_port = icp_port; - e->mcast.ttl = mcast_ttl; - e->options = options; - e->weight = weight; - e->host = xstrdup(host); - e->pinglist = NULL; - e->typelist = NULL; - e->acls = NULL; - e->icp_version = ICP_VERSION_CURRENT; - e->type = parseNeighborType(type); - e->tcp_up = 1; + p = xcalloc(1, sizeof(peer)); + p->http_port = http_port; + p->icp_port = icp_port; + p->mcast.ttl = mcast_ttl; + p->options = options; + p->weight = weight; + p->host = xstrdup(host); + p->pinglist = NULL; + p->typelist = NULL; + p->acls = NULL; + p->icp_version = ICP_VERSION_CURRENT; + p->type = parseNeighborType(type); + p->tcp_up = 1; /* Append peer */ if (!Peers.peers_head) - Peers.peers_head = e; + Peers.peers_head = p; if (Peers.peers_tail) - Peers.peers_tail->next = e; - Peers.peers_tail = e; + Peers.peers_tail->next = p; + Peers.peers_tail = p; Peers.n++; if (!Peers.first_ping) - Peers.first_ping = e; + Peers.first_ping = p; } void @@ -783,8 +783,8 @@ neighborAddDomainPing(const char *host, const char *domain) { struct _domain_ping *l = NULL; struct _domain_ping **L = NULL; - peer *e; - if ((e = neighborFindByName(host)) == NULL) { + peer *p; + if ((p = neighborFindByName(host)) == NULL) { debug(15, 0, "%s, line %d: No cache_host '%s'\n", cfg_filename, config_lineno, host); return; @@ -797,7 +797,7 @@ neighborAddDomainPing(const char *host, const char *domain) } l->domain = xstrdup(domain); l->next = NULL; - for (L = &(e->pinglist); *L; L = &((*L)->next)); + for (L = &(p->pinglist); *L; L = &((*L)->next)); *L = l; } @@ -806,8 +806,8 @@ neighborAddDomainType(const char *host, const char *domain, const char *type) { struct _domain_type *l = NULL; struct _domain_type **L = NULL; - peer *e; - if ((e = neighborFindByName(host)) == NULL) { + peer *p; + if ((p = neighborFindByName(host)) == NULL) { debug(15, 0, "%s, line %d: No cache_host '%s'\n", cfg_filename, config_lineno, host); return; @@ -816,19 +816,19 @@ neighborAddDomainType(const char *host, const char *domain, const char *type) l->type = parseNeighborType(type); l->domain = xstrdup(domain); l->next = NULL; - for (L = &(e->typelist); *L; L = &((*L)->next)); + for (L = &(p->typelist); *L; L = &((*L)->next)); *L = l; } void neighborAddAcl(const char *host, const char *aclname) { - peer *e; + peer *p; struct _acl_list *L = NULL; struct _acl_list **Tail = NULL; struct _acl *a = NULL; - if ((e = neighborFindByName(host)) == NULL) { + if ((p = neighborFindByName(host)) == NULL) { debug(15, 0, "%s, line %d: No cache_host '%s'\n", cfg_filename, config_lineno, host); return; @@ -858,19 +858,19 @@ neighborAddAcl(const char *host, const char *aclname) } #endif L->acl = a; - for (Tail = &(e->acls); *Tail; Tail = &((*Tail)->next)); + for (Tail = &(p->acls); *Tail; Tail = &((*Tail)->next)); *Tail = L; } peer * neighborFindByName(const char *name) { - peer *e = NULL; - for (e = Peers.peers_head; e; e = e->next) { - if (!strcasecmp(name, e->host)) + peer *p = NULL; + for (p = Peers.peers_head; p; p = p->next) { + if (!strcasecmp(name, p->host)) break; } - return e; + return p; } static peer_t @@ -891,88 +891,88 @@ parseNeighborType(const char *s) } int -neighborUp(const peer * e) +neighborUp(const peer * p) { - if (!e->tcp_up) + if (!p->tcp_up) return 0; - if (e->stats.ack_deficit >= HIER_MAX_DEFICIT) + if (p->stats.ack_deficit >= HIER_MAX_DEFICIT) return 0; return 1; } void -peerDestroy(peer * e) +peerDestroy(peer * p) { struct _domain_ping *l = NULL; struct _domain_ping *nl = NULL; - if (e == NULL) + if (p == NULL) return; - if (!e->tcp_up) - eventDelete(peerCheckConnect, e); - if (e->type == PEER_MULTICAST) { - if (e->mcast.flags & PEER_COUNT_EVENT_PENDING) - eventDelete(peerCountMcastPeersStart, e); - if (e->mcast.flags & PEER_COUNTING) - eventDelete(peerCountMcastPeersDone, e); + if (!p->tcp_up) + eventDelete(peerCheckConnect, p); + if (p->type == PEER_MULTICAST) { + if (p->mcast.flags & PEER_COUNT_EVENT_PENDING) + eventDelete(peerCountMcastPeersStart, p); + if (p->mcast.flags & PEER_COUNTING) + eventDelete(peerCountMcastPeersDone, p); } - for (l = e->pinglist; l; l = nl) { + for (l = p->pinglist; l; l = nl) { nl = l->next; safe_free(l->domain); safe_free(l); } - if (e->ip_lookup_pending) - ipcache_unregister(e->host, e->ipcache_fd); - safe_free(e->host); - safe_free(e); + if (p->ip_lookup_pending) + ipcacheUnregister(p->host, p); + safe_free(p->host); + safe_free(p); } static void peerDNSConfigure(int fd, const ipcache_addrs * ia, void *data) { - peer *e = data; + peer *p = data; struct sockaddr_in *ap; int j; - e->ip_lookup_pending = 0; - if (e->n_addresses == 0) { - debug(15, 1, "Configuring %s %s/%d/%d\n", neighborTypeStr(e), - e->host, e->http_port, e->icp_port); - if (e->type == PEER_MULTICAST) - debug(15, 1, " Multicast TTL = %d\n", e->mcast.ttl); + p->ip_lookup_pending = 0; + if (p->n_addresses == 0) { + debug(15, 1, "Configuring %s %s/%d/%d\n", neighborTypeStr(p), + p->host, p->http_port, p->icp_port); + if (p->type == PEER_MULTICAST) + debug(15, 1, " Multicast TTL = %d\n", p->mcast.ttl); } - e->n_addresses = 0; + p->n_addresses = 0; if (ia == NULL) { - debug(0, 0, "WARNING: DNS lookup for '%s' failed!\n", e->host); + debug(0, 0, "WARNING: DNS lookup for '%s' failed!\n", p->host); return; } if ((int) ia->count < 1) { - debug(0, 0, "WARNING: No IP address found for '%s'!\n", e->host); + debug(0, 0, "WARNING: No IP address found for '%s'!\n", p->host); return; } for (j = 0; j < (int) ia->count && j < PEER_MAX_ADDRESSES; j++) { - e->addresses[j] = ia->in_addrs[j]; - debug(15, 2, "--> IP address #%d: %s\n", j, inet_ntoa(e->addresses[j])); - e->n_addresses++; + p->addresses[j] = ia->in_addrs[j]; + debug(15, 2, "--> IP address #%d: %s\n", j, inet_ntoa(p->addresses[j])); + p->n_addresses++; } - ap = &e->in_addr; + ap = &p->in_addr; memset(ap, '\0', sizeof(struct sockaddr_in)); ap->sin_family = AF_INET; - ap->sin_addr = e->addresses[0]; - ap->sin_port = htons(e->icp_port); - if (e->type == PEER_MULTICAST) - peerCountMcastPeersSchedule(e, 10); + ap->sin_addr = p->addresses[0]; + ap->sin_port = htons(p->icp_port); + if (p->type == PEER_MULTICAST) + peerCountMcastPeersSchedule(p, 10); } static void peerRefreshDNS(void *junk) { - peer *e = NULL; + peer *p = NULL; peer *next = Peers.peers_head; - while ((e = next)) { - next = e->next; - e->ip_lookup_pending = 1; + while ((p = next)) { + next = p->next; + p->ip_lookup_pending = 1; /* some random, bogus FD for ipcache */ - e->ipcache_fd = Squid_MaxFD + current_time.tv_usec; - ipcache_nbgethostbyname(e->host, e->ipcache_fd, peerDNSConfigure, e); + p->ipcache_fd = Squid_MaxFD + current_time.tv_usec; + ipcache_nbgethostbyname(p->host, p->ipcache_fd, peerDNSConfigure, p); } /* Reconfigure the peers every hour */ eventAdd("peerRefreshDNS", peerRefreshDNS, NULL, 3600); diff --git a/src/net_db.cc b/src/net_db.cc index 6ad64b6ecb..1c7407f02f 100644 --- a/src/net_db.cc +++ b/src/net_db.cc @@ -1,6 +1,6 @@ /* - * $Id: net_db.cc,v 1.33 1997/04/29 22:13:04 wessels Exp $ + * $Id: net_db.cc,v 1.34 1997/04/30 20:06:33 wessels Exp $ * * DEBUG: section 37 Network Measurement Database * AUTHOR: Duane Wessels @@ -48,6 +48,7 @@ static void netdbPurgeLRU _PARAMS((void)); static net_db_peer *netdbPeerByName _PARAMS((const netdbEntry * n, const char *)); static net_db_peer *netdbPeerAdd _PARAMS((netdbEntry * n, peer * e)); static char *netdbPeerName _PARAMS((const char *name)); +static IPH netdbSendPing; /* We have to keep a local list of peer names. The Peers structure * gets freed during a reconfigure. We want this database to diff --git a/src/send-announce.cc b/src/send-announce.cc index 7ff6d0911b..ca19d6f4e5 100644 --- a/src/send-announce.cc +++ b/src/send-announce.cc @@ -1,6 +1,6 @@ /* - * $Id: send-announce.cc,v 1.32 1997/04/30 18:31:00 wessels Exp $ + * $Id: send-announce.cc,v 1.33 1997/04/30 20:06:35 wessels Exp $ * * DEBUG: section 27 Cache Announcer * AUTHOR: Duane Wessels @@ -31,8 +31,7 @@ #include "squid.h" -static void -send_announce _PARAMS((int fd, const ipcache_addrs * ia, void *data)); +static IPH send_announce; void start_announce(void *unused) diff --git a/src/ssl.cc b/src/ssl.cc index 4a63807682..90b921f799 100644 --- a/src/ssl.cc +++ b/src/ssl.cc @@ -1,6 +1,6 @@ /* - * $Id: ssl.cc,v 1.47 1997/04/30 18:31:01 wessels Exp $ + * $Id: ssl.cc,v 1.48 1997/04/30 20:06:36 wessels Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels @@ -58,7 +58,7 @@ static void sslWriteServer _PARAMS((int fd, void *)); static void sslWriteClient _PARAMS((int fd, void *)); static void sslConnected _PARAMS((int fd, void *)); static void sslProxyConnected _PARAMS((int fd, void *)); -static void sslConnect _PARAMS((int fd, const ipcache_addrs *, void *)); +static IPH sslConnect; static void sslErrorComplete _PARAMS((int, char *, int, int, void *)); static void sslClose _PARAMS((SslStateData * sslState)); static void sslClientClosed _PARAMS((int fd, void *)); @@ -119,7 +119,7 @@ sslStateFree(int fd, void *data) xfree(sslState->url); requestUnlink(sslState->request); if (sslState->ip_lookup_pending) - ipcache_unregister(sslState->host, sslState->server.fd); + ipcacheUnregister(sslState->host, sslState); safe_free(sslState); } @@ -205,6 +205,7 @@ sslWriteServer(int fd, void *data) len = write(sslState->server.fd, sslState->client.buf + sslState->client.offset, sslState->client.len - sslState->client.offset); + fd_bytes(fd, len, FD_WRITE); debug(26, 5, "sslWriteServer FD %d, wrote %d bytes\n", fd, len); if (len < 0) { if (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK) { @@ -247,6 +248,7 @@ sslWriteClient(int fd, void *data) len = write(sslState->client.fd, sslState->server.buf + sslState->server.offset, sslState->server.len - sslState->server.offset); + fd_bytes(fd, len, FD_WRITE); debug(26, 5, "sslWriteClient FD %d, wrote %d bytes\n", fd, len); if (len < 0) { if (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK) { diff --git a/src/tunnel.cc b/src/tunnel.cc index 3c7babc7f6..e098f13fc0 100644 --- a/src/tunnel.cc +++ b/src/tunnel.cc @@ -1,6 +1,6 @@ /* - * $Id: tunnel.cc,v 1.47 1997/04/30 18:31:01 wessels Exp $ + * $Id: tunnel.cc,v 1.48 1997/04/30 20:06:36 wessels Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels @@ -58,7 +58,7 @@ static void sslWriteServer _PARAMS((int fd, void *)); static void sslWriteClient _PARAMS((int fd, void *)); static void sslConnected _PARAMS((int fd, void *)); static void sslProxyConnected _PARAMS((int fd, void *)); -static void sslConnect _PARAMS((int fd, const ipcache_addrs *, void *)); +static IPH sslConnect; static void sslErrorComplete _PARAMS((int, char *, int, int, void *)); static void sslClose _PARAMS((SslStateData * sslState)); static void sslClientClosed _PARAMS((int fd, void *)); @@ -119,7 +119,7 @@ sslStateFree(int fd, void *data) xfree(sslState->url); requestUnlink(sslState->request); if (sslState->ip_lookup_pending) - ipcache_unregister(sslState->host, sslState->server.fd); + ipcacheUnregister(sslState->host, sslState); safe_free(sslState); } @@ -205,6 +205,7 @@ sslWriteServer(int fd, void *data) len = write(sslState->server.fd, sslState->client.buf + sslState->client.offset, sslState->client.len - sslState->client.offset); + fd_bytes(fd, len, FD_WRITE); debug(26, 5, "sslWriteServer FD %d, wrote %d bytes\n", fd, len); if (len < 0) { if (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK) { @@ -247,6 +248,7 @@ sslWriteClient(int fd, void *data) len = write(sslState->client.fd, sslState->server.buf + sslState->server.offset, sslState->server.len - sslState->server.offset); + fd_bytes(fd, len, FD_WRITE); debug(26, 5, "sslWriteClient FD %d, wrote %d bytes\n", fd, len); if (len < 0) { if (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK) { diff --git a/src/wais.cc b/src/wais.cc index 5130282e8b..6e5b0f929e 100644 --- a/src/wais.cc +++ b/src/wais.cc @@ -1,6 +1,6 @@ /* - * $Id: wais.cc,v 1.67 1997/04/30 18:31:05 wessels Exp $ + * $Id: wais.cc,v 1.68 1997/04/30 20:06:37 wessels Exp $ * * DEBUG: section 24 WAIS Relay * AUTHOR: Harvest Derived @@ -125,7 +125,7 @@ static PF waisTimeout; static PF waisReadReply; static void waisSendComplete _PARAMS((int, char *, int, int, void *)); static PF waisSendRequest; -static void waisConnect _PARAMS((int, const ipcache_addrs *, void *)); +static IPH waisConnect; static CNCB waisConnectDone; static void @@ -136,7 +136,7 @@ waisStateFree(int fd, void *data) return; storeUnlockObject(waisState->entry); if (waisState->ip_lookup_pending) - ipcache_unregister(waisState->relayhost, waisState->fd); + ipcacheUnregister(waisState->relayhost, waisState); xfree(waisState); }