neighbors.cc
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9/* DEBUG: section 15 Neighbor Routines */
10
11#include "squid.h"
12#include "acl/FilledChecklist.h"
13#include "anyp/PortCfg.h"
14#include "base/EnumIterator.h"
15#include "base/IoManip.h"
16#include "base/PackableStream.h"
17#include "CacheDigest.h"
18#include "CachePeer.h"
19#include "comm/Connection.h"
20#include "comm/ConnOpener.h"
21#include "debug/Messages.h"
22#include "event.h"
23#include "FwdState.h"
24#include "globals.h"
25#include "htcp.h"
26#include "HttpRequest.h"
27#include "icmp/net_db.h"
28#include "ICP.h"
29#include "int.h"
30#include "ip/Address.h"
31#include "ip/tools.h"
32#include "ipcache.h"
33#include "MemObject.h"
34#include "mgr/Registration.h"
35#include "multicast.h"
36#include "neighbors.h"
38#include "pconn.h"
39#include "PeerDigest.h"
40#include "PeerPoolMgr.h"
41#include "PeerSelectState.h"
42#include "RequestFlags.h"
43#include "SquidConfig.h"
44#include "SquidMath.h"
45#include "stat.h"
46#include "Store.h"
47#include "store_key_md5.h"
48#include "tools.h"
49
50/* count mcast group peers every 15 minutes */
51#define MCAST_COUNT_RATE 900
52
54static int peerWouldBePinged(const CachePeer *, PeerSelector *);
55static void neighborRemove(CachePeer *);
56static void neighborAlive(CachePeer *, const MemObject *, const icp_common_t *);
57#if USE_HTCP
58static void neighborAliveHtcp(CachePeer *, const MemObject *, const HtcpReplyData *);
59#endif
60static void neighborCountIgnored(CachePeer *);
61static void peerRefreshDNS(void *);
63static void peerProbeConnect(CachePeer *, const bool reprobeIfBusy = false);
65static void peerCountMcastPeersDone(void *data);
66static void peerCountMcastPeersStart(void *data);
67static void peerCountMcastPeersSchedule(CachePeer * p, time_t when);
71
72static void neighborIgnoreNonPeer(const Ip::Address &, icp_opcode);
74static void dump_peers(StoreEntry * sentry, CachePeer * peers);
75
76static unsigned short echo_port;
77
78static int NLateReplies = 0;
79static CachePeer *first_ping = nullptr;
80
81const char *
83{
84 if (p->type == PEER_NONE)
85 return "Non-Peer";
86
87 if (p->type == PEER_SIBLING)
88 return "Sibling";
89
90 if (p->type == PEER_MULTICAST)
91 return "Multicast Group";
92
93 return "Parent";
94}
95
98{
99 int j;
100
101 CachePeer *p = nullptr;
102 debugs(15, 3, "whichPeer: from " << from);
103
104 for (p = Config.peers; p; p = p->next) {
105 for (j = 0; j < p->n_addresses; ++j) {
106 if (from == p->addresses[j] && from.port() == p->icp.port) {
107 return p;
108 }
109 }
110 }
111
112 return nullptr;
113}
114
115peer_t
116neighborType(const CachePeer * p, const AnyP::Uri &url)
117{
118
119 const NeighborTypeDomainList *d = nullptr;
120
121 for (d = p->typelist; d; d = d->next) {
122 if (0 == matchDomainName(url.host(), d->domain))
123 if (d->type != PEER_NONE)
124 return d->type;
125 }
126#if PEER_MULTICAST_SIBLINGS
127 if (p->type == PEER_MULTICAST)
128 if (p->options.mcast_siblings)
129 return PEER_SIBLING;
130#endif
131
132 return p->type;
133}
134
138bool
140{
141 assert(ps);
142 HttpRequest *request = ps->request;
143 assert(request != nullptr);
144
145 if (neighborType(p, request->url) == PEER_SIBLING) {
146#if PEER_MULTICAST_SIBLINGS
147 if (p->type == PEER_MULTICAST && p->options.mcast_siblings &&
148 (request->flags.noCache || request->flags.refresh || request->flags.loopDetected || request->flags.needValidation))
149 debugs(15, 2, "multicast-siblings optimization match for " << *p << ", " << request->url.authority());
150#endif
151 if (request->flags.noCache)
152 return false;
153
154 if (request->flags.refresh)
155 return false;
156
157 if (request->flags.loopDetected)
158 return false;
159
160 if (request->flags.needValidation)
161 return false;
162 }
163
164 // CONNECT requests are proxy requests. Not to be forwarded to origin servers.
165 // Unless the destination port matches, in which case we MAY perform a 'DIRECT' to this CachePeer.
166 if (p->options.originserver && request->method == Http::METHOD_CONNECT && request->url.port() != p->http_port)
167 return false;
168
169 if (p->access == nullptr)
170 return true;
171
172 ACLFilledChecklist checklist(p->access, request, nullptr);
173 checklist.al = ps->al;
174 if (ps->al && ps->al->reply) {
175 checklist.reply = ps->al->reply.getRaw();
176 HTTPMSGLOCK(checklist.reply);
177 }
178 checklist.syncAle(request, nullptr);
179 return checklist.fastCheck().allowed();
180}
181
182/* Return TRUE if it is okay to send an ICP request to this CachePeer. */
183static int
185{
186 assert(ps);
187 HttpRequest *request = ps->request;
188
189 if (p->icp.port == 0)
190 return 0;
191
192 if (p->options.no_query)
193 return 0;
194
196 return 0;
197
198 if (p->n_addresses == 0)
199 return 0;
200
202 return 0;
203
204 /* the case below seems strange, but can happen if the
205 * URL host is on the other side of a firewall */
206 if (p->type == PEER_SIBLING)
207 if (!request->flags.hierarchical)
208 return 0;
209
210 if (!peerAllowedToUse(p, ps))
211 return 0;
212
213 /* Ping dead peers every timeout interval */
215 return 1;
216
217 if (!neighborUp(p))
218 return 0;
219
220 return 1;
221}
222
223bool
225{
226 const int effectiveLimit = p->max_conn <= 0 ? Squid_MaxFD : p->max_conn;
227 const int remaining = effectiveLimit - p->stats.conn_open;
228 debugs(15, 7, remaining << '=' << effectiveLimit << '-' << p->stats.conn_open);
229 return remaining > 0;
230}
231
232bool
234{
235 // Standby connections can be used without opening new connections.
236 const int standbys = p->standby.pool ? p->standby.pool->count() : 0;
237
238 // XXX: Some idle pconns can be used without opening new connections.
239 // Complication: Idle pconns cannot be reused for some requests.
240 const int usableIdles = 0;
241
242 const int available = standbys + usableIdles;
243 debugs(15, 7, available << '=' << standbys << '+' << usableIdles);
244 return available > 0;
245}
246
247void
249{
250 --p->stats.conn_open;
252 p->standby.waitingForClose = false;
253 PeerPoolMgr::Checkpoint(p->standby.mgr, "conn closed");
254 }
255}
256
257/* Return TRUE if it is okay to send an HTTP request to this CachePeer. */
258int
260{
262 return 0;
263
264 if (!peerAllowedToUse(p, ps))
265 return 0;
266
267 if (!neighborUp(p))
268 return 0;
269
270 return 1;
271}
272
273int
275{
276 CachePeer *p = nullptr;
277 int count = 0;
278
279 for (p = Config.peers; p; p = p->next)
280 if (peerWouldBePinged(p, ps))
281 ++count;
282
283 debugs(15, 3, "neighborsCount: " << count);
284
285 return count;
286}
287
288CachePeer *
290{
291 assert(ps);
292 HttpRequest *request = ps->request;
293
294 CachePeer *p = nullptr;
295
296 for (p = Config.peers; p; p = p->next) {
297 if (!neighborUp(p))
298 continue;
299
300 if (neighborType(p, request->url) != PEER_PARENT)
301 continue;
302
303 if (!peerHTTPOkay(p, ps))
304 continue;
305
306 break;
307 }
308
309 debugs(15, 3, "returning " << RawPointer(p).orNil());
310 return p;
311}
312
313CachePeer *
315{
316 assert(ps);
317 HttpRequest *request = ps->request;
318
319 CachePeer *p;
320 CachePeer *q = nullptr;
321
322 for (p = Config.peers; p; p = p->next) {
323 if (!p->options.roundrobin)
324 continue;
325
326 if (neighborType(p, request->url) != PEER_PARENT)
327 continue;
328
329 if (!peerHTTPOkay(p, ps))
330 continue;
331
332 if (p->weight == 0)
333 continue;
334
335 if (q) {
336 if (p->weight == q->weight) {
337 if (q->rr_count < p->rr_count)
338 continue;
339 } else if ( ((double) q->rr_count / q->weight) < ((double) p->rr_count / p->weight)) {
340 continue;
341 }
342 }
343
344 q = p;
345 }
346
347 if (q)
348 ++ q->rr_count;
349
350 debugs(15, 3, "returning " << RawPointer(q).orNil());
351
352 return q;
353}
354
355CachePeer *
357{
358 assert(ps);
359 HttpRequest *request = ps->request;
360
361 CachePeer *p;
362 CachePeer *q = nullptr;
363 int weighted_rtt;
364
365 for (p = Config.peers; p; p = p->next) {
367 continue;
368
369 if (neighborType(p, request->url) != PEER_PARENT)
370 continue;
371
372 if (!peerHTTPOkay(p, ps))
373 continue;
374
375 if (q && q->rr_count < p->rr_count)
376 continue;
377
378 q = p;
379 }
380
381 if (q && q->rr_count > 1000000)
382 for (p = Config.peers; p; p = p->next) {
384 continue;
385
386 if (neighborType(p, request->url) != PEER_PARENT)
387 continue;
388
389 p->rr_count = 0;
390 }
391
392 if (q) {
393 weighted_rtt = (q->stats.rtt - q->basetime) / q->weight;
394
395 if (weighted_rtt < 1)
396 weighted_rtt = 1;
397
398 q->rr_count += weighted_rtt;
399
400 debugs(15, 3, "getWeightedRoundRobinParent: weighted_rtt " << weighted_rtt);
401 }
402
403 debugs(15, 3, "returning " << RawPointer(q).orNil());
404 return q;
405}
406
418static void
420{
421 peerClearRR();
422 eventAdd("peerClearRR", peerClearRRLoop, data, 5 * 60.0, 0);
423}
424
430void
432{
433 static bool event_added = false;
434 if (!event_added) {
435 peerClearRRLoop(nullptr);
436 event_added=true;
437 }
438}
439
447void
449{
450 CachePeer *p = nullptr;
451 for (p = Config.peers; p; p = p->next) {
452 p->rr_count = 1;
453 }
454}
455
456void
458{
459 if (p->stats.logged_state == PEER_DEAD && p->tcp_up) {
460 debugs(15, DBG_IMPORTANT, "Detected REVIVED " << neighborTypeStr(p) << ": " << *p);
462 peerClearRR();
463 if (p->standby.mgr.valid())
464 PeerPoolMgr::Checkpoint(p->standby.mgr, "revived peer");
465 }
466
468 p->stats.probe_start = 0;
469
470 // TODO: Remove or explain how we could detect an alive peer without IP addresses
471 if (!p->n_addresses)
473}
474
475CachePeer *
477{
478 assert(ps);
479 HttpRequest *request = ps->request;
480
481 CachePeer *p = nullptr;
482
483 for (p = Config.peers; p; p = p->next) {
484 if (neighborType(p, request->url) != PEER_PARENT)
485 continue;
486
487 if (!p->options.default_parent)
488 continue;
489
490 if (!peerHTTPOkay(p, ps))
491 continue;
492
493 debugs(15, 3, "returning " << *p);
494
495 return p;
496 }
497
498 // TODO: Refactor similar get*() functions to use our return/reporting style
499 debugs(15, 3, "none found");
500 return nullptr;
501}
502
503CachePeer *
505{
506 return p->next;
507}
508
509CachePeer *
511{
512 return Config.peers;
513}
514
515static void
517{
518 CachePeer *p = nullptr;
519 CachePeer **P = nullptr;
520 p = Config.peers;
521 P = &Config.peers;
522
523 while (p) {
524 if (target == p)
525 break;
526
527 P = &p->next;
528
529 p = p->next;
530 }
531
532 if (p) {
533 *P = p->next;
534 p->next = nullptr;
535 delete p;
536 --Config.npeers;
537 }
538
540}
541
542static void
544{
545 Mgr::RegisterAction("server_list",
546 "Peer Cache Statistics",
547 neighborDumpPeers, 0, 1);
548}
549
550void
552{
553 struct servent *sep = nullptr;
554 const char *me = getMyHostname();
555 CachePeer *thisPeer = nullptr;
556 CachePeer *next = nullptr;
557
559
561
562 for (thisPeer = Config.peers; thisPeer; thisPeer = next) {
563 next = thisPeer->next;
564
565 if (0 != strcmp(thisPeer->host, me))
566 continue;
567
568 for (AnyP::PortCfgPointer s = HttpPortList; s != nullptr; s = s->next) {
569 if (thisPeer->http_port != s->s.port())
570 continue;
571
572 debugs(15, DBG_IMPORTANT, "WARNING: Peer looks like this host." <<
573 Debug::Extra << "Ignoring cache_peer " << *thisPeer);
574
575 neighborRemove(thisPeer);
576 }
577 }
578 }
579
580 peerRefreshDNS((void *) 1);
581
582 sep = getservbyname("echo", "udp");
583 echo_port = sep ? ntohs((unsigned short) sep->s_port) : 7;
584
586}
587
588int
590 StoreEntry * entry,
591 IRCB * callback,
592 PeerSelector *ps,
593 int *exprep,
594 int *timeout)
595{
596 const char *url = entry->url();
597 MemObject *mem = entry->mem_obj;
598 CachePeer *p = nullptr;
599 int i;
600 int reqnum = 0;
601 int flags;
602 int peers_pinged = 0;
603 int parent_timeout = 0, parent_exprep = 0;
604 int sibling_timeout = 0, sibling_exprep = 0;
605 int mcast_timeout = 0, mcast_exprep = 0;
606
607 if (Config.peers == nullptr)
608 return 0;
609
610 assert(!entry->hasDisk());
611
613
614 mem->ping_reply_callback = callback;
615
616 mem->ircb_data = ps;
617
618 reqnum = icpSetCacheKey((const cache_key *)entry->key);
619
620 for (i = 0, p = first_ping; i++ < Config.npeers; p = p->next) {
621 if (p == nullptr)
622 p = Config.peers;
623
624 debugs(15, 5, "candidate: " << *p);
625
626 if (!peerWouldBePinged(p, ps))
627 continue; /* next CachePeer */
628
629 ++peers_pinged;
630
631 debugs(15, 4, "pinging cache_peer " << *p << " for '" << url << "'");
632
633 debugs(15, 3, "neighborsUdpPing: key = '" << entry->getMD5Text() << "'");
634
635 debugs(15, 3, "neighborsUdpPing: reqnum = " << reqnum);
636
637#if USE_HTCP
638 if (p->options.htcp && !p->options.htcp_only_clr) {
639 if (Config.Port.htcp <= 0) {
640 debugs(15, DBG_CRITICAL, "ERROR: HTCP is disabled! Cannot send HTCP request to peer.");
641 continue;
642 }
643
644 debugs(15, 3, "neighborsUdpPing: sending HTCP query");
645 if (htcpQuery(entry, request, p) <= 0)
646 continue; // unable to send.
647 } else
648#endif
649 {
651 debugs(15, DBG_CRITICAL, "ERROR: ICP is disabled! Cannot send ICP request to peer.");
652 continue;
653 } else {
654
655 if (p->type == PEER_MULTICAST)
657
658 if (p->icp.port == echo_port) {
659 debugs(15, 4, "neighborsUdpPing: Looks like a dumb cache, send DECHO ping");
660 // TODO: Get ALE from callback_data if possible.
661 icpCreateAndSend(ICP_DECHO, 0, url, reqnum, 0,
662 icpOutgoingConn->fd, p->in_addr, nullptr);
663 } else {
664 flags = 0;
665
667 if (p->icp.version == ICP_VERSION_2)
668 flags |= ICP_FLAG_SRC_RTT;
669
670 // TODO: Get ALE from callback_data if possible.
671 icpCreateAndSend(ICP_QUERY, flags, url, reqnum, 0,
672 icpOutgoingConn->fd, p->in_addr, nullptr);
673 }
674 }
675 }
676
677 ++ p->stats.pings_sent;
678
679 if (p->type == PEER_MULTICAST) {
680 mcast_exprep += p->mcast.n_replies_expected;
681 mcast_timeout += (p->stats.rtt * p->mcast.n_replies_expected);
682 } else if (neighborUp(p)) {
683 /* its alive, expect a reply from it */
684
685 if (neighborType(p, request->url) == PEER_PARENT) {
686 ++parent_exprep;
687 parent_timeout += p->stats.rtt;
688 } else {
689 ++sibling_exprep;
690 sibling_timeout += p->stats.rtt;
691 }
692 } else {
693 /* Neighbor is dead; ping it anyway, but don't expect a reply */
694 /* log it once at the threshold */
695
696 if (p->stats.logged_state == PEER_ALIVE) {
697 debugs(15, DBG_IMPORTANT, "Detected DEAD " << neighborTypeStr(p) << ": " << *p);
699 }
700 }
701
703
704 /*
705 * keep probe_start == 0 for a multicast CachePeer,
706 * so neighborUp() never says this CachePeer is dead.
707 */
708
709 if ((p->type != PEER_MULTICAST) && (p->stats.probe_start == 0))
711 }
712
713 if ((first_ping = first_ping->next) == nullptr)
715
716 /*
717 * How many replies to expect?
718 */
719 *exprep = parent_exprep + sibling_exprep + mcast_exprep;
720
721 /*
722 * If there is a configured timeout, use it
723 */
725 *timeout = Config.Timeout.icp_query;
726 else {
727 if (*exprep > 0) {
728 if (parent_exprep)
729 *timeout = 2 * parent_timeout / parent_exprep;
730 else if (mcast_exprep)
731 *timeout = 2 * mcast_timeout / mcast_exprep;
732 else
733 *timeout = 2 * sibling_timeout / sibling_exprep;
734 } else
735 *timeout = 2000; /* 2 seconds */
736
738 if (*timeout > Config.Timeout.icp_query_max)
739 *timeout = Config.Timeout.icp_query_max;
740
741 if (*timeout < Config.Timeout.icp_query_min)
742 *timeout = Config.Timeout.icp_query_min;
743 }
744
745 return peers_pinged;
746}
747
748/* lookup the digest of a given CachePeer */
751{
752#if USE_CACHE_DIGESTS
753 assert(ps);
754 HttpRequest *request = ps->request;
755 const cache_key *key = request ? storeKeyPublicByRequest(request) : nullptr;
756 assert(p);
757 assert(request);
758 debugs(15, 5, "cache_peer " << *p);
759 /* does the peeer have a valid digest? */
760
761 if (!p->digest) {
762 debugs(15, 5, "peerDigestLookup: gone!");
763 return LOOKUP_NONE;
764 } else if (!peerHTTPOkay(p, ps)) {
765 debugs(15, 5, "peerDigestLookup: !peerHTTPOkay");
766 return LOOKUP_NONE;
767 } else if (!p->digest->flags.needed) {
768 debugs(15, 5, "peerDigestLookup: note need");
770 return LOOKUP_NONE;
771 } else if (!p->digest->flags.usable) {
772 debugs(15, 5, "peerDigestLookup: !ready && " << (p->digest->flags.requested ? "" : "!") << "requested");
773 return LOOKUP_NONE;
774 }
775
776 debugs(15, 5, "OK to lookup cache_peer " << *p);
777 assert(p->digest->cd);
778 /* does digest predict a hit? */
779
780 if (!p->digest->cd->contains(key))
781 return LOOKUP_MISS;
782
783 debugs(15, 5, "HIT for cache_peer " << *p);
784
785 return LOOKUP_HIT;
786#else
787 (void)p;
788 (void)ps;
789#endif
790
791 return LOOKUP_NONE;
792}
793
794/* select best CachePeer based on cache digests */
795CachePeer *
797{
798 CachePeer *best_p = nullptr;
799#if USE_CACHE_DIGESTS
800 assert(ps);
801 HttpRequest *request = ps->request;
802
803 int best_rtt = 0;
804 int choice_count = 0;
805 int ichoice_count = 0;
806 CachePeer *p;
807 int p_rtt;
808 int i;
809
810 if (!request->flags.hierarchical)
811 return nullptr;
812
814
815 for (i = 0, p = first_ping; i++ < Config.npeers; p = p->next) {
816 lookup_t lookup;
817
818 if (!p)
819 p = Config.peers;
820
821 if (i == 1)
822 first_ping = p;
823
824 lookup = peerDigestLookup(p, ps);
825
826 if (lookup == LOOKUP_NONE)
827 continue;
828
829 ++choice_count;
830
831 if (lookup == LOOKUP_MISS)
832 continue;
833
834 p_rtt = netdbHostRtt(p->host);
835
836 debugs(15, 5, "cache_peer " << *p << " rtt: " << p_rtt);
837
838 /* is this CachePeer better than others in terms of rtt ? */
839 if (!best_p || (p_rtt && p_rtt < best_rtt)) {
840 best_p = p;
841 best_rtt = p_rtt;
842
843 if (p_rtt) /* informative choice (aka educated guess) */
844 ++ichoice_count;
845
846 debugs(15, 4, "cache_peer " << *p << " leads with rtt " << best_rtt);
847 }
848 }
849
850 debugs(15, 4, "neighborsDigestSelect: choices: " << choice_count << " (" << ichoice_count << ")");
851 peerNoteDigestLookup(request, best_p,
852 best_p ? LOOKUP_HIT : (choice_count ? LOOKUP_MISS : LOOKUP_NONE));
853 request->hier.n_choices = choice_count;
854 request->hier.n_ichoices = ichoice_count;
855#else
856 (void)ps;
857#endif
858
859 return best_p;
860}
861
862void
864{
865#if USE_CACHE_DIGESTS
866 if (p)
867 strncpy(request->hier.cd_host, p->host, sizeof(request->hier.cd_host)-1);
868 else
869 *request->hier.cd_host = '\0';
870
871 request->hier.cd_lookup = lookup;
872 debugs(15, 4, "cache_peer " << RawPointer(p).orNil() << ", lookup: " << lookup_t_str[lookup]);
873#else
874 (void)request;
875 (void)p;
876 (void)lookup;
877#endif
878}
879
880static void
881neighborAlive(CachePeer * p, const MemObject *, const icp_common_t * header)
882{
883 peerAlive(p);
884 ++ p->stats.pings_acked;
885
886 if ((icp_opcode) header->opcode <= ICP_END)
887 ++ p->icp.counts[header->opcode];
888
889 p->icp.version = (int) header->version;
890}
891
892static void
894{
895 int rtt, rtt_av_factor;
896
897 if (!mem)
898 return;
899
900 if (!mem->start_ping.tv_sec)
901 return;
902
903 rtt = tvSubMsec(mem->start_ping, current_time);
904
905 if (rtt < 1 || rtt > 10000)
906 return;
907
908 rtt_av_factor = RTT_AV_FACTOR;
909
911 rtt_av_factor = RTT_BACKGROUND_AV_FACTOR;
912
913 p->stats.rtt = Math::intAverage(p->stats.rtt, rtt, p->stats.pings_acked, rtt_av_factor);
914}
915
916#if USE_HTCP
917static void
919{
920 peerAlive(p);
921 ++ p->stats.pings_acked;
922 ++ p->htcp.counts[htcp->hit ? 1 : 0];
923 p->htcp.version = htcp->version;
924}
925
926#endif
927
928static void
930{
931 if (p == nullptr)
932 return;
933
935
936 ++NLateReplies;
937}
938
939static void
941{
942 static uint64_t ignoredReplies = 0;
943 if (isPowTen(++ignoredReplies)) {
944 debugs(15, DBG_IMPORTANT, "WARNING: Ignored " << ignoredReplies << " ICP replies from non-peers" <<
945 Debug::Extra << "last seen non-peer source address: " << from <<
946 Debug::Extra << "last seen ICP reply opcode: " << icp_opcode_str[opcode]);
947 }
948}
949
950/* ignoreMulticastReply
951 *
952 * * We want to ignore replies from multicast peers if the
953 * * cache_host_domain rules would normally prevent the CachePeer
954 * * from being used
955 */
956static int
958{
959 if (p == nullptr)
960 return 0;
961
962 if (!p->options.mcast_responder)
963 return 0;
964
965 if (peerHTTPOkay(p, ps))
966 return 0;
967
968 return 1;
969}
970
978void
979neighborsUdpAck(const cache_key * key, icp_common_t * header, const Ip::Address &from)
980{
981 CachePeer *p = nullptr;
982 StoreEntry *entry;
983 MemObject *mem = nullptr;
984 peer_t ntype = PEER_NONE;
985 icp_opcode opcode = (icp_opcode) header->opcode;
986
987 debugs(15, 6, "neighborsUdpAck: opcode " << opcode << " '" << storeKeyText(key) << "'");
988
989 if ((entry = Store::Root().findCallbackXXX(key)))
990 mem = entry->mem_obj;
991
992 if ((p = whichPeer(from)))
993 neighborAlive(p, mem, header);
994
995 if (opcode > ICP_END)
996 return;
997
998 const char *opcode_d = icp_opcode_str[opcode];
999
1000 if (p)
1001 neighborUpdateRtt(p, mem);
1002
1003 /* Does the entry exist? */
1004 if (nullptr == entry) {
1005 debugs(12, 3, "neighborsUdpAck: Cache key '" << storeKeyText(key) << "' not found");
1007 return;
1008 }
1009
1010 /* check if someone is already fetching it */
1011 if (EBIT_TEST(entry->flags, ENTRY_DISPATCHED)) {
1012 debugs(15, 3, "neighborsUdpAck: '" << storeKeyText(key) << "' already being fetched.");
1014 return;
1015 }
1016
1017 if (mem == nullptr) {
1018 debugs(15, 2, "Ignoring " << opcode_d << " for missing mem_obj: " << storeKeyText(key));
1020 return;
1021 }
1022
1023 if (entry->ping_status != PING_WAITING) {
1024 debugs(15, 2, "neighborsUdpAck: Late " << opcode_d << " for " << storeKeyText(key));
1026 return;
1027 }
1028
1029 if (!entry->locked()) {
1030 // TODO: many entries are unlocked; why is this reported at level 1?
1031 debugs(12, DBG_IMPORTANT, "neighborsUdpAck: '" << storeKeyText(key) << "' has no locks");
1033 return;
1034 }
1035
1036 if (!mem->ircb_data) {
1037 debugs(12, DBG_IMPORTANT, "ERROR: Squid BUG: missing ICP callback data for " << *entry);
1039 return;
1040 }
1041
1042 debugs(15, 3, opcode_d << " for " << storeKeyText(key) << " from " << RawPointer(p).orNil("source"));
1043
1044 if (p) {
1045 ntype = neighborType(p, mem->request->url);
1046 }
1047
1048 if (ignoreMulticastReply(p, mem->ircb_data)) {
1050 } else if (opcode == ICP_MISS) {
1051 if (p == nullptr) {
1052 neighborIgnoreNonPeer(from, opcode);
1053 } else {
1054 mem->ping_reply_callback(p, ntype, AnyP::PROTO_ICP, header, mem->ircb_data);
1055 }
1056 } else if (opcode == ICP_HIT) {
1057 if (p == nullptr) {
1058 neighborIgnoreNonPeer(from, opcode);
1059 } else {
1060 header->opcode = ICP_HIT;
1061 mem->ping_reply_callback(p, ntype, AnyP::PROTO_ICP, header, mem->ircb_data);
1062 }
1063 } else if (opcode == ICP_DECHO) {
1064 if (p == nullptr) {
1065 neighborIgnoreNonPeer(from, opcode);
1066 } else if (ntype == PEER_SIBLING) {
1067 debug_trap("neighborsUdpAck: Found non-ICP cache as SIBLING\n");
1068 debug_trap("neighborsUdpAck: non-ICP neighbors must be a PARENT\n");
1069 } else {
1070 mem->ping_reply_callback(p, ntype, AnyP::PROTO_ICP, header, mem->ircb_data);
1071 }
1072 } else if (opcode == ICP_SECHO) {
1073 if (p) {
1074 debugs(15, DBG_IMPORTANT, "Ignoring SECHO from neighbor " << *p);
1076 } else {
1077 debugs(15, DBG_IMPORTANT, "Unsolicited SECHO from " << from);
1078 }
1079 } else if (opcode == ICP_DENIED) {
1080 if (p == nullptr) {
1081 neighborIgnoreNonPeer(from, opcode);
1082 } else if (p->stats.pings_acked > 100) {
1083 if (100 * p->icp.counts[ICP_DENIED] / p->stats.pings_acked > 95) {
1084 debugs(15, DBG_CRITICAL, "Disabling cache_peer " << *p <<
1085 " because over 95% of its replies are UDP_DENIED");
1086 neighborRemove(p);
1087 p = nullptr;
1088 } else {
1090 }
1091 }
1092 } else if (opcode == ICP_MISS_NOFETCH) {
1093 mem->ping_reply_callback(p, ntype, AnyP::PROTO_ICP, header, mem->ircb_data);
1094 } else {
1095 debugs(15, DBG_CRITICAL, "ERROR: neighborsUdpAck: Unexpected ICP reply: " << opcode_d);
1096 }
1097}
1098
1099CachePeer *
1100findCachePeerByName(const char * const name)
1101{
1102 CachePeer *p = nullptr;
1103
1104 for (p = Config.peers; p; p = p->next) {
1105 if (!strcasecmp(name, p->name))
1106 break;
1107 }
1108
1109 return p;
1110}
1111
1112int
1114{
1115 if (!p->tcp_up) {
1116 // TODO: When CachePeer gets its own CodeContext, pass that context instead of nullptr
1117 CallService(nullptr, [&] {
1118 peerProbeConnect(const_cast<CachePeer*>(p));
1119 });
1120 return 0;
1121 }
1122
1123 /*
1124 * The CachePeer can not be UP if we don't have any IP addresses
1125 * for it.
1126 */
1127 if (0 == p->n_addresses) {
1128 debugs(15, 8, "DOWN (no-ip): " << *p);
1129 return 0;
1130 }
1131
1132 if (p->options.no_query) {
1133 debugs(15, 8, "UP (no-query): " << *p);
1134 return 1;
1135 }
1136
1137 if (p->stats.probe_start != 0 &&
1139 debugs(15, 8, "DOWN (dead): " << *p);
1140 return 0;
1141 }
1142
1143 debugs(15, 8, "UP: " << *p);
1144 return 1;
1145}
1146
1147time_t
1148positiveTimeout(const time_t timeout)
1149{
1150 return max(static_cast<time_t>(1), timeout);
1151}
1152
1153static void
1155{
1156 // TODO: connections to no-longer valid IP addresses should be
1157 // closed when we can detect such IP addresses.
1158
1159 CachePeer *p = (CachePeer *)data;
1160
1161 if (p->n_addresses == 0) {
1162 debugs(15, Important(29), "Configuring " << neighborTypeStr(p) << " " << *p);
1163
1164 if (p->type == PEER_MULTICAST)
1165 debugs(15, DBG_IMPORTANT, " Multicast TTL = " << p->mcast.ttl);
1166 }
1167
1168 p->n_addresses = 0;
1169
1170 if (ia == nullptr) {
1171 debugs(0, DBG_CRITICAL, "WARNING: DNS lookup for '" << *p << "' failed!");
1172 return;
1173 }
1174
1175 if (ia->empty()) {
1176 debugs(0, DBG_CRITICAL, "WARNING: No IP address found for '" << *p << "'!");
1177 return;
1178 }
1179
1180 for (const auto &ip: ia->goodAndBad()) { // TODO: Consider using just good().
1182 const auto idx = p->n_addresses++;
1183 p->addresses[idx] = ip;
1184 debugs(15, 2, "--> IP address #" << idx << ": " << p->addresses[idx]);
1185 } else {
1186 debugs(15, 3, "ignoring remaining " << (ia->size() - p->n_addresses) << " ips");
1187 break;
1188 }
1189 }
1190
1191 p->in_addr.setEmpty();
1192 p->in_addr = p->addresses[0];
1193 p->in_addr.port(p->icp.port);
1194
1195 peerProbeConnect(p, true); // detect any died or revived peers ASAP
1196
1197 if (p->type == PEER_MULTICAST)
1199
1200#if USE_ICMP
1201 if (p->type != PEER_MULTICAST && IamWorkerProcess())
1202 if (!p->options.no_netdb_exchange)
1203 eventAddIsh("netdbExchangeStart", netdbExchangeStart, p, 30.0, 1);
1204#endif
1205
1206 if (p->standby.mgr.valid())
1207 PeerPoolMgr::Checkpoint(p->standby.mgr, "resolved peer");
1208}
1209
1210static void
1212{
1213 CachePeer *p = nullptr;
1214
1215 if (eventFind(peerRefreshDNS, nullptr))
1216 eventDelete(peerRefreshDNS, nullptr);
1217
1218 if (!data && 0 == stat5minClientRequests()) {
1219 /* no recent client traffic, wait a bit */
1220 eventAddIsh("peerRefreshDNS", peerRefreshDNS, nullptr, 180.0, 1);
1221 return;
1222 }
1223
1224 for (p = Config.peers; p; p = p->next)
1226
1227 /* Reconfigure the peers every hour */
1228 eventAddIsh("peerRefreshDNS", peerRefreshDNS, nullptr, 3600.0, 1);
1229}
1230
1232static bool
1234{
1235 if (p->testing_now > 0) {
1236 debugs(15, 8, "yes, probing " << p);
1237 return true;
1238 }
1239 if (squid_curtime - p->stats.last_connect_probe == 0) {
1240 debugs(15, 8, "yes, just probed " << p);
1241 return true;
1242 }
1243 return false;
1244}
1245/*
1246* peerProbeConnect will be called on dead peers by neighborUp
1247*/
1248static void
1249peerProbeConnect(CachePeer *p, const bool reprobeIfBusy)
1250{
1251 if (peerProbeIsBusy(p)) {
1252 p->reprobe = reprobeIfBusy;
1253 return;
1254 }
1255 p->reprobe = false;
1256
1257 const auto ctimeout = p->connectTimeout();
1258 /* for each IP address of this CachePeer. find one that we can connect to and probe it. */
1259 for (int i = 0; i < p->n_addresses; ++i) {
1261 conn->remote = p->addresses[i];
1262 conn->remote.port(p->http_port);
1263 conn->setPeer(p);
1264 getOutgoingAddress(nullptr, conn);
1265
1266 ++ p->testing_now;
1267
1268 AsyncCall::Pointer call = commCbCall(15,3, "peerProbeConnectDone", CommConnectCbPtrFun(peerProbeConnectDone, p));
1269 Comm::ConnOpener *cs = new Comm::ConnOpener(conn, call, ctimeout);
1270 cs->setHost(p->host);
1271 AsyncJob::Start(cs);
1272 }
1273
1275}
1276
1277static void
1279{
1280 CachePeer *p = (CachePeer*)data;
1281
1282 if (status == Comm::OK)
1283 p->noteSuccess();
1284 else
1286
1287 -- p->testing_now;
1288 conn->close();
1289 // TODO: log this traffic.
1290
1291 if (p->reprobe)
1293}
1294
1295static void
1297{
1299 return;
1300
1301 eventAdd("peerCountMcastPeersStart",
1303 p,
1304 (double) when, 1);
1305
1307}
1308
1309static void
1311{
1312 const auto peer = static_cast<CachePeer*>(data);
1313 CallContextCreator([peer] {
1315 });
1317}
1318
1320static void
1322{
1323 // XXX: Do not create lots of complex fake objects (while abusing their
1324 // APIs) to pass around a few basic data points like start_ping and ping!
1325 MemObject *mem;
1326 int reqnum;
1327 // TODO: use class AnyP::Uri instead of constructing and re-parsing a string
1328 LOCAL_ARRAY(char, url, MAX_URL);
1329 assert(p->type == PEER_MULTICAST);
1330 p->mcast.flags.count_event_pending = false;
1331 snprintf(url, MAX_URL, "http://");
1332 p->in_addr.toUrl(url+7, MAX_URL -8 );
1333 strcat(url, "/");
1334 const auto mx = MasterXaction::MakePortless<XactionInitiator::initPeerMcast>();
1335 auto *req = HttpRequest::FromUrlXXX(url, mx);
1336 assert(req != nullptr);
1338 ale->request = req;
1339 CodeContext::Reset(ale);
1341 const auto psstate = new PeerSelector(nullptr);
1342 psstate->request = req;
1343 HTTPMSGLOCK(psstate->request);
1344 psstate->entry = fake;
1345 psstate->peerCountMcastPeerXXX = cbdataReference(p);
1346 psstate->ping.start = current_time;
1347 psstate->al = ale;
1348 mem = fake->mem_obj;
1349 mem->request = psstate->request;
1350 mem->start_ping = current_time;
1352 mem->ircb_data = psstate;
1354 p->mcast.id = mem->id;
1355 reqnum = icpSetCacheKey((const cache_key *)fake->key);
1356 icpCreateAndSend(ICP_QUERY, 0, url, reqnum, 0,
1357 icpOutgoingConn->fd, p->in_addr, psstate->al);
1358 fake->ping_status = PING_WAITING; // TODO: refactor to use PeerSelector::startPingWaiting()
1359 eventAdd("peerCountMcastPeersDone",
1361 psstate,
1362 Config.Timeout.mcast_icp_query / 1000.0, 1);
1363 p->mcast.flags.counting = true;
1364}
1365
1366static void
1368{
1369 const auto psstate = static_cast<PeerSelector*>(data);
1370 CallBack(psstate->al, [psstate] {
1371 peerCountMcastPeersAbort(psstate);
1372 delete psstate;
1373 });
1374}
1375
1378static void
1380{
1381 StoreEntry *fake = psstate->entry;
1382
1384 CachePeer *p = (CachePeer *)psstate->peerCountMcastPeerXXX;
1385 p->mcast.flags.counting = false;
1387 debugs(15, DBG_IMPORTANT, "Group " << *p << ": " << psstate->ping.n_recv <<
1388 " replies, "<< std::setw(4)<< std::setprecision(2) <<
1389 p->mcast.avg_n_members <<" average, RTT " << p->stats.rtt);
1391 }
1392
1394
1395 fake->abort(); // sets ENTRY_ABORTED and initiates related cleanup
1396 fake->mem_obj->request = nullptr;
1397 fake->unlock("peerCountMcastPeersDone");
1398}
1399
1400static void
1402{
1403 const auto psstate = static_cast<PeerSelector*>(data);
1404 StoreEntry *fake = psstate->entry;
1405 assert(fake);
1406 MemObject *mem = fake->mem_obj;
1407 assert(mem);
1408 int rtt = tvSubMsec(mem->start_ping, current_time);
1409 assert(proto == AnyP::PROTO_ICP);
1410 ++ psstate->ping.n_recv;
1411 int rtt_av_factor = RTT_AV_FACTOR;
1412
1414 rtt_av_factor = RTT_BACKGROUND_AV_FACTOR;
1415
1416 p->stats.rtt = Math::intAverage(p->stats.rtt, rtt, psstate->ping.n_recv, rtt_av_factor);
1417}
1418
1419static void
1421{
1422 dump_peers(sentry, Config.peers);
1423}
1424
1425void
1427{
1428 if (p->options.proxy_only)
1429 storeAppendPrintf(sentry, " proxy-only");
1430
1431 if (p->options.no_query)
1432 storeAppendPrintf(sentry, " no-query");
1433
1434 if (p->options.background_ping)
1435 storeAppendPrintf(sentry, " background-ping");
1436
1437 if (p->options.no_digest)
1438 storeAppendPrintf(sentry, " no-digest");
1439
1440 if (p->options.default_parent)
1441 storeAppendPrintf(sentry, " default");
1442
1443 if (p->options.roundrobin)
1444 storeAppendPrintf(sentry, " round-robin");
1445
1446 if (p->options.carp)
1447 storeAppendPrintf(sentry, " carp");
1448
1449#if USE_AUTH
1450 if (p->options.userhash)
1451 storeAppendPrintf(sentry, " userhash");
1452#endif
1453
1454 if (p->options.sourcehash)
1455 storeAppendPrintf(sentry, " sourcehash");
1456
1458 storeAppendPrintf(sentry, " weighted-round-robin");
1459
1460 if (p->options.mcast_responder)
1461 storeAppendPrintf(sentry, " multicast-responder");
1462
1463#if PEER_MULTICAST_SIBLINGS
1464 if (p->options.mcast_siblings)
1465 storeAppendPrintf(sentry, " multicast-siblings");
1466#endif
1467
1468 if (p->weight != 1)
1469 storeAppendPrintf(sentry, " weight=%d", p->weight);
1470
1471 if (p->options.closest_only)
1472 storeAppendPrintf(sentry, " closest-only");
1473
1474#if USE_HTCP
1475 if (p->options.htcp) {
1476 storeAppendPrintf(sentry, " htcp");
1478 bool doneopts = false;
1479 if (p->options.htcp_oldsquid) {
1480 storeAppendPrintf(sentry, "oldsquid");
1481 doneopts = true;
1482 }
1483 if (p->options.htcp_no_clr) {
1484 storeAppendPrintf(sentry, "%sno-clr",(doneopts?",":"="));
1485 doneopts = true;
1486 }
1487 if (p->options.htcp_no_purge_clr) {
1488 storeAppendPrintf(sentry, "%sno-purge-clr",(doneopts?",":"="));
1489 doneopts = true;
1490 }
1491 if (p->options.htcp_only_clr) {
1492 storeAppendPrintf(sentry, "%sonly-clr",(doneopts?",":"="));
1493 //doneopts = true; // uncomment if more opts are added
1494 }
1495 }
1496 }
1497#endif
1498
1500 storeAppendPrintf(sentry, " no-netdb-exchange");
1501
1502#if USE_DELAY_POOLS
1503 if (p->options.no_delay)
1504 storeAppendPrintf(sentry, " no-delay");
1505#endif
1506
1507 if (p->login)
1508 storeAppendPrintf(sentry, " login=%s", p->login);
1509
1510 if (p->mcast.ttl > 0)
1511 storeAppendPrintf(sentry, " ttl=%d", p->mcast.ttl);
1512
1513 if (p->connect_timeout_raw > 0)
1514 storeAppendPrintf(sentry, " connect-timeout=%d", (int)p->connect_timeout_raw);
1515
1517 storeAppendPrintf(sentry, " connect-fail-limit=%d", p->connect_fail_limit);
1518
1519#if USE_CACHE_DIGESTS
1520
1521 if (p->digest_url)
1522 storeAppendPrintf(sentry, " digest-url=%s", p->digest_url);
1523
1524#endif
1525
1526 if (p->options.allow_miss)
1527 storeAppendPrintf(sentry, " allow-miss");
1528
1529 if (p->options.no_tproxy)
1530 storeAppendPrintf(sentry, " no-tproxy");
1531
1532 if (p->max_conn > 0)
1533 storeAppendPrintf(sentry, " max-conn=%d", p->max_conn);
1534 if (p->standby.limit > 0)
1535 storeAppendPrintf(sentry, " standby=%d", p->standby.limit);
1536
1537 if (p->options.originserver)
1538 storeAppendPrintf(sentry, " originserver");
1539
1540 if (p->domain)
1541 storeAppendPrintf(sentry, " forceddomain=%s", p->domain);
1542
1543 if (p->connection_auth == 0)
1544 storeAppendPrintf(sentry, " connection-auth=off");
1545 else if (p->connection_auth == 1)
1546 storeAppendPrintf(sentry, " connection-auth=on");
1547 else if (p->connection_auth == 2)
1548 storeAppendPrintf(sentry, " connection-auth=auto");
1549
1550 PackableStream os(*sentry);
1551 p->secure.dumpCfg(os, "tls-");
1552 storeAppendPrintf(sentry, "\n");
1553}
1554
1555static void
1557{
1558 char ntoabuf[MAX_IPSTRLEN];
1559 int i;
1560
1561 if (peers == nullptr)
1562 storeAppendPrintf(sentry, "There are no neighbors installed.\n");
1563
1564 for (CachePeer *e = peers; e; e = e->next) {
1565 assert(e->host != nullptr);
1566 storeAppendPrintf(sentry, "\n%-11.11s: %s\n",
1567 neighborTypeStr(e),
1568 e->name);
1569 storeAppendPrintf(sentry, "Host : %s/%d/%d\n",
1570 e->host,
1571 e->http_port,
1572 e->icp.port);
1573 storeAppendPrintf(sentry, "Flags :");
1574 dump_peer_options(sentry, e);
1575
1576 for (i = 0; i < e->n_addresses; ++i) {
1577 storeAppendPrintf(sentry, "Address[%d] : %s\n", i,
1578 e->addresses[i].toStr(ntoabuf,MAX_IPSTRLEN) );
1579 }
1580
1581 storeAppendPrintf(sentry, "Status : %s\n",
1582 neighborUp(e) ? "Up" : "Down");
1583 storeAppendPrintf(sentry, "FETCHES : %d\n", e->stats.fetches);
1584 storeAppendPrintf(sentry, "OPEN CONNS : %d\n", e->stats.conn_open);
1585 storeAppendPrintf(sentry, "AVG RTT : %d msec\n", e->stats.rtt);
1586
1587 if (!e->options.no_query) {
1588 storeAppendPrintf(sentry, "LAST QUERY : %8d seconds ago\n",
1589 (int) (squid_curtime - e->stats.last_query));
1590
1591 if (e->stats.last_reply > 0)
1592 storeAppendPrintf(sentry, "LAST REPLY : %8d seconds ago\n",
1593 (int) (squid_curtime - e->stats.last_reply));
1594 else
1595 storeAppendPrintf(sentry, "LAST REPLY : none received\n");
1596
1597 storeAppendPrintf(sentry, "PINGS SENT : %8d\n", e->stats.pings_sent);
1598
1599 storeAppendPrintf(sentry, "PINGS ACKED: %8d %3d%%\n",
1600 e->stats.pings_acked,
1601 Math::intPercent(e->stats.pings_acked, e->stats.pings_sent));
1602 }
1603
1604 storeAppendPrintf(sentry, "IGNORED : %8d %3d%%\n", e->stats.ignored_replies, Math::intPercent(e->stats.ignored_replies, e->stats.pings_acked));
1605
1606 if (!e->options.no_query) {
1607 storeAppendPrintf(sentry, "Histogram of PINGS ACKED:\n");
1608#if USE_HTCP
1609
1610 if (e->options.htcp) {
1611 storeAppendPrintf(sentry, "\tMisses\t%8d %3d%%\n",
1612 e->htcp.counts[0],
1613 Math::intPercent(e->htcp.counts[0], e->stats.pings_acked));
1614 storeAppendPrintf(sentry, "\tHits\t%8d %3d%%\n",
1615 e->htcp.counts[1],
1616 Math::intPercent(e->htcp.counts[1], e->stats.pings_acked));
1617 } else {
1618#endif
1619
1620 for (auto op : WholeEnum<icp_opcode>()) {
1621 if (e->icp.counts[op] == 0)
1622 continue;
1623
1624 storeAppendPrintf(sentry, " %12.12s : %8d %3d%%\n",
1625 icp_opcode_str[op],
1626 e->icp.counts[op],
1627 Math::intPercent(e->icp.counts[op], e->stats.pings_acked));
1628 }
1629
1630#if USE_HTCP
1631
1632 }
1633
1634#endif
1635
1636 }
1637
1638 if (e->stats.last_connect_failure) {
1639 storeAppendPrintf(sentry, "Last failed connect() at: %s\n",
1640 Time::FormatHttpd(e->stats.last_connect_failure));
1641 }
1642
1643 storeAppendPrintf(sentry, "keep-alive ratio: %d%%\n", Math::intPercent(e->stats.n_keepalives_recv, e->stats.n_keepalives_sent));
1644 }
1645}
1646
1647#if USE_HTCP
1648void
1650{
1652 MemObject *mem = nullptr;
1653 CachePeer *p;
1654 peer_t ntype = PEER_NONE;
1655 debugs(15, 6, "neighborsHtcpReply: " <<
1656 (htcp->hit ? "HIT" : "MISS") << " " <<
1657 storeKeyText(key) );
1658
1659 if (nullptr != e)
1660 mem = e->mem_obj;
1661
1662 if ((p = whichPeer(from)))
1663 neighborAliveHtcp(p, mem, htcp);
1664
1665 /* Does the entry exist? */
1666 if (nullptr == e) {
1667 debugs(12, 3, "neighyborsHtcpReply: Cache key '" << storeKeyText(key) << "' not found");
1669 return;
1670 }
1671
1672 /* check if someone is already fetching it */
1673 if (EBIT_TEST(e->flags, ENTRY_DISPATCHED)) {
1674 debugs(15, 3, "neighborsUdpAck: '" << storeKeyText(key) << "' already being fetched.");
1676 return;
1677 }
1678
1679 if (mem == nullptr) {
1680 debugs(15, 2, "Ignoring reply for missing mem_obj: " << storeKeyText(key));
1682 return;
1683 }
1684
1685 if (e->ping_status != PING_WAITING) {
1686 debugs(15, 2, "neighborsUdpAck: Entry " << storeKeyText(key) << " is not PING_WAITING");
1688 return;
1689 }
1690
1691 if (!e->locked()) {
1692 // TODO: many entries are unlocked; why is this reported at level 1?
1693 debugs(12, DBG_IMPORTANT, "neighborsUdpAck: '" << storeKeyText(key) << "' has no locks");
1695 return;
1696 }
1697
1698 if (!mem->ircb_data) {
1699 debugs(12, DBG_IMPORTANT, "ERROR: Squid BUG: missing HTCP callback data for " << *e);
1701 return;
1702 }
1703
1704 if (p) {
1705 ntype = neighborType(p, mem->request->url);
1706 neighborUpdateRtt(p, mem);
1707 }
1708
1709 if (ignoreMulticastReply(p, mem->ircb_data)) {
1711 return;
1712 }
1713
1714 debugs(15, 3, "neighborsHtcpReply: e = " << e);
1715 // TODO: Refactor (ping_reply_callback,ircb_data) to add CodeContext.
1716 mem->ping_reply_callback(p, ntype, AnyP::PROTO_HTCP, htcp, mem->ircb_data);
1717}
1718
1719/*
1720 * Send HTCP CLR messages to all peers configured to receive them.
1721 */
1722void
1724{
1725 CachePeer *p;
1726 char buf[128];
1727
1728 for (p = Config.peers; p; p = p->next) {
1729 if (!p->options.htcp) {
1730 continue;
1731 }
1732 if (p->options.htcp_no_clr) {
1733 continue;
1734 }
1735 if (p->options.htcp_no_purge_clr && reason == HTCP_CLR_PURGE) {
1736 continue;
1737 }
1738 debugs(15, 3, "neighborsHtcpClear: sending CLR to " << p->in_addr.toUrl(buf, 128));
1739 htcpClear(e, req, method, p, reason);
1740 }
1741}
1742
1743#endif
1744
void CallContextCreator(Fun &&creator)
Definition: CodeContext.h:148
void CallService(const CodeContext::Pointer &serviceContext, Fun &&service)
Definition: CodeContext.h:133
void CallBack(const CodeContext::Pointer &callbackContext, Fun &&callback)
Definition: CodeContext.h:116
CommCbFunPtrCallT< Dialer > * commCbCall(int debugSection, int debugLevel, const char *callName, const Dialer &dialer)
Definition: CommCalls.h:312
void CNCB(const Comm::ConnectionPointer &conn, Comm::Flag status, int xerrno, void *data)
Definition: CommCalls.h:33
void getOutgoingAddress(HttpRequest *request, const Comm::ConnectionPointer &conn)
Definition: FwdState.cc:1476
RawPointerT< Pointer > RawPointer(const char *label, const Pointer &ptr)
convenience wrapper for creating RawPointerT<> objects
Definition: IoManip.h:43
time_t squid_curtime
Definition: stub_libtime.cc:20
AnyP::PortCfgPointer HttpPortList
list of Squid http(s)_port configured
Definition: PortCfg.cc:22
class SquidConfig Config
Definition: SquidConfig.cc:12
int conn
the current server connection FD
Definition: Transport.cc:26
int matchDomainName(const char *h, const char *d, MatchDomainNameFlags flags)
Definition: Uri.cc:816
#define assert(EX)
Definition: assert.h:17
int cbdataReferenceValid(const void *p)
Definition: cbdata.cc:265
#define cbdataReferenceDone(var)
Definition: cbdata.h:352
#define cbdataReference(var)
Definition: cbdata.h:343
Acl::Answer const & fastCheck()
Definition: Checklist.cc:332
AccessLogEntry::Pointer al
info for the future access.log, and external ACL
void syncAle(HttpRequest *adaptedRequest, const char *logUri) const override
assigns uninitialized adapted_request and url ALE components
HttpReplyPointer reply
HttpRequest * request
bool allowed() const
Definition: Acl.h:156
Definition: Uri.h:31
SBuf & authority(bool requirePort=false) const
Definition: Uri.cc:642
void port(const Port p)
reset authority port subcomponent
Definition: Uri.h:95
void host(const char *src)
Definition: Uri.cc:100
static void Start(const Pointer &job)
Definition: AsyncJob.cc:24
bool contains(const cache_key *key) const
Definition: CacheDigest.cc:93
CbcPointer< PeerPoolMgr > mgr
pool manager
Definition: CachePeer.h:211
acl_access * access
Definition: CachePeer.h:104
bool closest_only
Definition: CachePeer.h:115
int weight
Definition: CachePeer.h:150
bool no_tproxy
Definition: CachePeer.h:143
void noteSuccess()
reacts to a successful establishment of a connection to this cache_peer
Definition: CachePeer.cc:63
bool htcp_oldsquid
Definition: CachePeer.h:118
bool no_query
Definition: CachePeer.h:108
NeighborTypeDomainList * typelist
Definition: CachePeer.h:103
int basetime
Definition: CachePeer.h:151
bool originserver
Definition: CachePeer.h:142
time_t probe_start
Definition: CachePeer.h:78
bool background_ping
Definition: CachePeer.h:109
peer_t type
Definition: CachePeer.h:66
bool roundrobin
Definition: CachePeer.h:112
int n_addresses
Definition: CachePeer.h:180
int connection_auth
0 - off, 1 - on, 2 - auto
Definition: CachePeer.h:224
unsigned short http_port
Definition: CachePeer.h:102
bool proxy_only
Definition: CachePeer.h:107
int pings_sent
Definition: CachePeer.h:71
int logged_state
so we can print dead/revived msgs
Definition: CachePeer.h:83
char * login
Definition: CachePeer.h:203
time_t last_connect_probe
Definition: CachePeer.h:82
bool htcp_no_purge_clr
Definition: CachePeer.h:120
char * host
Definition: CachePeer.h:64
Security::PeerOptions secure
security settings for peer connection
Definition: CachePeer.h:219
time_t connect_timeout_raw
connect_timeout; use connectTimeout() instead!
Definition: CachePeer.h:204
bool mcast_siblings
Definition: CachePeer.h:145
char * domain
Forced domain.
Definition: CachePeer.h:216
int limit
the limit itself
Definition: CachePeer.h:212
time_t last_query
Definition: CachePeer.h:79
CachePeer * next
Definition: CachePeer.h:182
PeerDigest * digest
Definition: CachePeer.h:167
int n_replies_expected
Definition: CachePeer.h:156
int tcp_up
Definition: CachePeer.h:174
bool counting
Definition: CachePeer.h:162
int rtt
Definition: CachePeer.h:74
bool no_digest
Definition: CachePeer.h:110
Ip::Address in_addr
Definition: CachePeer.h:68
PconnPool * pool
idle connection pool for this peer
Definition: CachePeer.h:210
int rr_count
Definition: CachePeer.h:181
bool waitingForClose
a conn must close before we open a standby conn
Definition: CachePeer.h:213
bool sourcehash
Definition: CachePeer.h:141
int connect_fail_limit
Definition: CachePeer.h:205
double avg_n_members
Definition: CachePeer.h:154
int n_times_counted
Definition: CachePeer.h:155
struct CachePeer::icp_ icp
time_t last_reply
Definition: CachePeer.h:80
int pings_acked
Definition: CachePeer.h:72
bool no_netdb_exchange
Definition: CachePeer.h:124
int max_conn
Definition: CachePeer.h:206
struct CachePeer::@30 mcast
struct CachePeer::@28 htcp
bool htcp_only_clr
Definition: CachePeer.h:121
struct CachePeer::@27 stats
time_t connectTimeout() const
Definition: CachePeer.cc:121
struct CachePeer::@29 options
int counts[2]
Definition: CachePeer.h:97
bool count_event_pending
Definition: CachePeer.h:161
char * name
Definition: CachePeer.h:59
Ip::Address addresses[10]
Definition: CachePeer.h:179
bool userhash
Definition: CachePeer.h:139
int conn_open
current opened connections
Definition: CachePeer.h:84
int testing_now
Definition: CachePeer.h:183
bool default_parent
Definition: CachePeer.h:111
bool carp
Definition: CachePeer.h:129
bool reprobe
whether to do another TCP probe after current TCP probes
Definition: CachePeer.h:177
bool allow_miss
Definition: CachePeer.h:128
char * digest_url
Definition: CachePeer.h:168
int ignored_replies
Definition: CachePeer.h:75
double version
Definition: CachePeer.h:96
struct CachePeer::@30::@36 flags
void noteFailure(Http::StatusCode code)
Definition: CachePeer.cc:75
bool mcast_responder
Definition: CachePeer.h:114
struct CachePeer::@34 standby
optional "cache_peer standby=limit" feature
bool weighted_roundrobin
Definition: CachePeer.h:113
bool htcp_no_clr
Definition: CachePeer.h:119
bool no_delay
Definition: CachePeer.h:126
Cbc * valid() const
was set and is valid
Definition: CbcPointer.h:41
static void Reset()
forgets the current context, setting it to nil/unknown
Definition: CodeContext.cc:77
void setHost(const char *)
set the hostname note for this connection
Definition: ConnOpener.cc:100
static std::ostream & Extra(std::ostream &)
Definition: debug.cc:1313
size_t size() const noexcept
all cached IPs
Definition: ipcache.h:62
IpsSelector< IpsIterator > goodAndBad() const
all IPs
Definition: ipcache.h:249
bool empty() const noexcept
whether we cached no IPs at all
Definition: ipcache.h:61
encapsulates DNS lookup results
Definition: LookupDetails.h:23
char cd_host[SQUIDHOSTNAMELEN]
double version
Definition: htcp.h:32
int hit
Definition: htcp.h:29
HttpRequestMethod method
Definition: HttpRequest.h:114
static HttpRequest * FromUrlXXX(const char *url, const MasterXaction::Pointer &, const HttpRequestMethod &method=Http::METHOD_GET)
Definition: HttpRequest.cc:528
HierarchyLogEntry hier
Definition: HttpRequest.h:157
RequestFlags flags
Definition: HttpRequest.h:141
AnyP::Uri url
the request URI
Definition: HttpRequest.h:115
void setEmpty()
Fast reset of the stored content to what would be after default constructor.
Definition: Address.cc:184
char * toUrl(char *buf, unsigned int len) const
Definition: Address.cc:874
unsigned short port() const
Definition: Address.cc:778
IRCB * ping_reply_callback
Definition: MemObject.h:214
HttpRequestPointer request
Definition: MemObject.h:211
struct timeval start_ping
Definition: MemObject.h:213
PeerSelector * ircb_data
Definition: MemObject.h:215
representation of a neighbor_type_domain configuration directive. A POD
NeighborTypeDomainList * next
void count(int uses)
bool requested
Definition: PeerDigest.h:90
bool usable
Definition: PeerDigest.h:89
bool needed
Definition: PeerDigest.h:88
CacheDigest * cd
Definition: PeerDigest.h:83
struct PeerDigest::@84 flags
static void Checkpoint(const Pointer &mgr, const char *reason)
Definition: PeerPoolMgr.cc:228
HttpRequest * request
AccessLogEntry::Pointer al
info for the future access.log entry
void * peerCountMcastPeerXXX
a hack to help peerCountMcastPeersStart()
ping_data ping
StoreEntry * entry
C * getRaw() const
Definition: RefCount.h:89
bool needValidation
Definition: RequestFlags.h:50
bool loopDetected
Definition: RequestFlags.h:40
bool hierarchical
Definition: RequestFlags.h:38
virtual void dumpCfg(std::ostream &, const char *pfx) const
output squid.conf syntax with 'pfx' prefix on parameters for the stored settings
Definition: PeerOptions.cc:105
struct SquidConfig::@94 Port
time_t deadPeer
Definition: SquidConfig.h:122
int mcast_icp_query
Definition: SquidConfig.h:127
struct SquidConfig::@106 onoff
int icp_query_max
Definition: SquidConfig.h:125
int icp_query_min
Definition: SquidConfig.h:126
CachePeer * peers
Definition: SquidConfig.h:245
unsigned short icp
Definition: SquidConfig.h:139
struct SquidConfig::@93 Timeout
time_t backgroundPingRate
Definition: SquidConfig.h:106
unsigned short htcp
Definition: SquidConfig.h:142
uint16_t flags
Definition: Store.h:232
int locked() const
Definition: Store.h:146
int unlock(const char *context)
Definition: store.cc:455
const char * url() const
Definition: store.cc:1552
bool hasDisk(const sdirno dirn=-1, const sfileno filen=-1) const
Definition: store.cc:1915
const char * getMD5Text() const
Definition: store.cc:206
MemObject * mem_obj
Definition: Store.h:221
ping_status_t ping_status
Definition: Store.h:242
void abort()
Definition: store.cc:1063
StoreEntry * findCallbackXXX(const cache_key *)
Definition: Controller.cc:395
unsigned char version
Definition: ICP.h:40
unsigned char opcode
Definition: ICP.h:38
int n_recv
Definition: PingData.h:39
A const & max(A const &lhs, A const &rhs)
#define Important(id)
Definition: Messages.h:93
#define DBG_IMPORTANT
Definition: Stream.h:38
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Stream.h:194
#define DBG_CRITICAL
Definition: Stream.h:37
#define RTT_BACKGROUND_AV_FACTOR
Definition: defines.h:83
#define PEER_TCP_MAGIC_COUNT
Definition: defines.h:124
#define PEER_MAX_ADDRESSES
Definition: defines.h:81
#define ICP_FLAG_SRC_RTT
Definition: defines.h:41
#define PEER_ALIVE
Definition: defines.h:86
#define PEER_DEAD
Definition: defines.h:85
#define ICP_VERSION_2
Definition: defines.h:44
#define EBIT_TEST(flag, bit)
Definition: defines.h:69
#define RTT_AV_FACTOR
Definition: defines.h:82
#define MAX_URL
Definition: defines.h:78
@ PING_WAITING
Sent ICP queries to peers and still awaiting responses.
Definition: enums.h:43
htcp_clr_reason
Definition: enums.h:240
@ HTCP_CLR_PURGE
Definition: enums.h:241
peer_t
Definition: enums.h:27
@ PEER_SIBLING
Definition: enums.h:29
@ PEER_PARENT
Definition: enums.h:30
@ PEER_NONE
Definition: enums.h:28
@ PEER_MULTICAST
Definition: enums.h:31
@ ENTRY_DISPATCHED
Definition: enums.h:101
void eventAddIsh(const char *name, EVH *func, void *arg, double delta_ish, int weight)
Definition: event.cc:114
int eventFind(EVH *func, void *arg)
Definition: event.cc:145
void eventDelete(EVH *func, void *arg)
Definition: event.cc:127
void eventAdd(const char *name, EVH *func, void *arg, double when, int weight, bool cbdata)
Definition: event.cc:107
int Squid_MaxFD
void ipcache_nbgethostbyname(const char *name, IPH *handler, void *handlerData)
Definition: ipcache.cc:608
int icpSetCacheKey(const cache_key *key)
Definition: icp_v2.cc:861
void icpCreateAndSend(icp_opcode, int flags, char const *url, int reqnum, int pad, int fd, const Ip::Address &from, AccessLogEntryPointer)
Definition: icp_v2.cc:418
icp_opcode
Definition: icp_opcode.h:13
@ ICP_DECHO
Definition: icp_opcode.h:26
@ ICP_QUERY
Definition: icp_opcode.h:16
@ ICP_MISS_NOFETCH
Definition: icp_opcode.h:36
@ ICP_END
Definition: icp_opcode.h:39
@ ICP_DENIED
Definition: icp_opcode.h:37
@ ICP_SECHO
Definition: icp_opcode.h:25
@ ICP_MISS
Definition: icp_opcode.h:18
@ ICP_HIT
Definition: icp_opcode.h:17
Comm::ConnectionPointer icpOutgoingConn
Definition: icp_v2.cc:101
Comm::ConnectionPointer icpIncomingConn
Definition: icp_v2.cc:99
int htcpQuery(StoreEntry *e, HttpRequest *req, CachePeer *p)
Definition: htcp.cc:1516
void htcpClear(StoreEntry *e, HttpRequest *req, const HttpRequestMethod &, CachePeer *p, htcp_clr_reason reason)
Definition: htcp.cc:1565
void HTTPMSGLOCK(Http::Message *a)
Definition: Message.h:161
const char * icp_opcode_str[]
int isPowTen(int count)
Definition: int.cc:17
#define MAX_IPSTRLEN
Length of buffer that needs to be allocated to old a null-terminated IP-string.
Definition: forward.h:25
void IPH(const ipcache_addrs *, const Dns::LookupDetails &details, void *)
Definition: ipcache.h:227
const char * lookup_t_str[]
lookup_t
Definition: lookup_t.h:12
@ LOOKUP_MISS
Definition: lookup_t.h:15
@ LOOKUP_HIT
Definition: lookup_t.h:14
@ LOOKUP_NONE
Definition: lookup_t.h:13
void OBJH(StoreEntry *)
Definition: forward.h:44
int mcastSetTtl(int fd, int mcast_ttl)
Definition: multicast.cc:20
ProtocolType
Definition: ProtocolType.h:23
@ PROTO_HTCP
Definition: ProtocolType.h:33
@ PROTO_ICP
Definition: ProtocolType.h:31
bool IsConnOpen(const Comm::ConnectionPointer &conn)
Definition: Connection.cc:27
Flag
Definition: Flag.h:15
@ OK
Definition: Flag.h:16
@ scNone
Definition: StatusCode.h:21
@ METHOD_CONNECT
Definition: MethodType.h:29
@ METHOD_GET
Definition: MethodType.h:25
int intPercent(const int a, const int b)
Definition: SquidMath.cc:13
double doubleAverage(const double, const double, int, const int)
Definition: SquidMath.cc:31
int intAverage(const int, const int, int, const int)
Definition: SquidMath.cc:40
void RegisterAction(char const *action, char const *desc, OBJH *handler, int pw_req_flag, int atomic)
Definition: Registration.cc:16
SSL Connection
Definition: Session.h:45
Controller & Root()
safely access controller singleton
Definition: Controller.cc:938
const char * FormatHttpd(time_t)
Definition: gadgets.cc:116
static void peerClearRRLoop(void *data)
Definition: neighbors.cc:419
static void peerCountMcastPeersDone(void *data)
Definition: neighbors.cc:1367
void peerNoteDigestLookup(HttpRequest *request, CachePeer *p, lookup_t lookup)
Definition: neighbors.cc:863
static int peerWouldBePinged(const CachePeer *, PeerSelector *)
Definition: neighbors.cc:184
static void neighborAliveHtcp(CachePeer *, const MemObject *, const HtcpReplyData *)
Definition: neighbors.cc:918
static void peerCountMcastPeersSchedule(CachePeer *p, time_t when)
Definition: neighbors.cc:1296
void neighborsHtcpClear(StoreEntry *e, HttpRequest *req, const HttpRequestMethod &method, htcp_clr_reason reason)
Definition: neighbors.cc:1723
CachePeer * getFirstUpParent(PeerSelector *ps)
Definition: neighbors.cc:289
CachePeer * findCachePeerByName(const char *const name)
cache_peer with a given name (or nil)
Definition: neighbors.cc:1100
static IPH peerDNSConfigure
Definition: neighbors.cc:62
CachePeer * whichPeer(const Ip::Address &from)
Definition: neighbors.cc:97
static CachePeer * first_ping
Definition: neighbors.cc:79
static void peerCountMcastPeersCreateAndSend(CachePeer *p)
initiates an ICP transaction to a multicast peer
Definition: neighbors.cc:1321
void neighborsHtcpReply(const cache_key *key, HtcpReplyData *htcp, const Ip::Address &from)
Definition: neighbors.cc:1649
static void neighborUpdateRtt(CachePeer *p, MemObject *mem)
Definition: neighbors.cc:893
static CNCB peerProbeConnectDone
Definition: neighbors.cc:64
void peerAlive(CachePeer *p)
Definition: neighbors.cc:457
void peerClearRR()
Definition: neighbors.cc:448
void neighbors_init(void)
Definition: neighbors.cc:551
static OBJH neighborDumpPeers
Definition: neighbors.cc:73
bool peerHasConnAvailable(const CachePeer *p)
Whether the peer has idle or standby connections that can be used now.
Definition: neighbors.cc:233
int neighborsCount(PeerSelector *ps)
Definition: neighbors.cc:274
static void peerCountMcastPeersAbort(PeerSelector *)
Definition: neighbors.cc:1379
void dump_peer_options(StoreEntry *sentry, CachePeer *p)
Definition: neighbors.cc:1426
int neighborUp(const CachePeer *p)
Definition: neighbors.cc:1113
static bool peerProbeIsBusy(const CachePeer *p)
whether new TCP probes are currently banned
Definition: neighbors.cc:1233
int peerHTTPOkay(const CachePeer *p, PeerSelector *ps)
Definition: neighbors.cc:259
CachePeer * getDefaultParent(PeerSelector *ps)
Definition: neighbors.cc:476
CachePeer * getRoundRobinParent(PeerSelector *ps)
Definition: neighbors.cc:314
const char * neighborTypeStr(const CachePeer *p)
Definition: neighbors.cc:82
time_t positiveTimeout(const time_t timeout)
Definition: neighbors.cc:1148
bool peerAllowedToUse(const CachePeer *, PeerSelector *)
Definition: neighbors.cc:139
static void neighborsRegisterWithCacheManager()
Definition: neighbors.cc:543
void peerClearRRStart(void)
Definition: neighbors.cc:431
bool peerCanOpenMore(const CachePeer *p)
Whether we can open new connections to the peer (e.g., despite max-conn)
Definition: neighbors.cc:224
static int NLateReplies
Definition: neighbors.cc:78
peer_t neighborType(const CachePeer *p, const AnyP::Uri &url)
Definition: neighbors.cc:116
static void dump_peers(StoreEntry *sentry, CachePeer *peers)
Definition: neighbors.cc:1556
int neighborsUdpPing(HttpRequest *request, StoreEntry *entry, IRCB *callback, PeerSelector *ps, int *exprep, int *timeout)
Definition: neighbors.cc:589
CachePeer * neighborsDigestSelect(PeerSelector *ps)
Definition: neighbors.cc:796
static IRCB peerCountHandleIcpReply
Definition: neighbors.cc:70
static unsigned short echo_port
Definition: neighbors.cc:76
static void peerRefreshDNS(void *)
Definition: neighbors.cc:1211
static void neighborAlive(CachePeer *, const MemObject *, const icp_common_t *)
Definition: neighbors.cc:881
CachePeer * getNextPeer(CachePeer *p)
Definition: neighbors.cc:504
lookup_t peerDigestLookup(CachePeer *p, PeerSelector *ps)
Definition: neighbors.cc:750
#define MCAST_COUNT_RATE
Definition: neighbors.cc:51
CachePeer * getFirstPeer(void)
Definition: neighbors.cc:510
static void neighborCountIgnored(CachePeer *)
Definition: neighbors.cc:929
void peerConnClosed(CachePeer *p)
Notifies peer of an associated connection closure.
Definition: neighbors.cc:248
static void neighborIgnoreNonPeer(const Ip::Address &, icp_opcode)
Definition: neighbors.cc:940
static int ignoreMulticastReply(CachePeer *p, PeerSelector *ps)
Definition: neighbors.cc:957
void neighborsUdpAck(const cache_key *key, icp_common_t *header, const Ip::Address &from)
Definition: neighbors.cc:979
static void neighborRemove(CachePeer *)
Definition: neighbors.cc:516
static void peerProbeConnect(CachePeer *, const bool reprobeIfBusy=false)
Definition: neighbors.cc:1249
CachePeer * getWeightedRoundRobinParent(PeerSelector *ps)
Definition: neighbors.cc:356
static void peerCountMcastPeersStart(void *data)
Definition: neighbors.cc:1310
int netdbHostRtt(const char *host)
Definition: net_db.cc:959
void netdbExchangeStart(void *data)
Definition: net_db.cc:1196
void peerDigestNeeded(PeerDigest *pd)
Definition: peer_digest.cc:128
#define LOCAL_ARRAY(type, name, size)
Definition: squid.h:68
int stat5minClientRequests(void)
Definition: stat.cc:1687
unsigned char cache_key
Store key.
Definition: forward.h:29
void storeAppendPrintf(StoreEntry *e, const char *fmt,...)
Definition: store.cc:841
StoreEntry * storeCreateEntry(const char *url, const char *logUrl, const RequestFlags &flags, const HttpRequestMethod &method)
Definition: store.cc:745
const cache_key * storeKeyPublicByRequest(HttpRequest *request, const KeyScope keyScope)
const char * storeKeyText(const cache_key *key)
unsigned short port
Definition: CachePeer.h:91
int counts[ICP_END+1]
Definition: CachePeer.h:90
int unsigned int
Definition: stub_fd.cc:19
bool IamWorkerProcess()
whether the current process handles HTTP transactions and such
Definition: stub_tools.cc:47
struct timeval current_time
the current UNIX time in timeval {seconds, microseconds} format
Definition: gadgets.cc:17
int tvSubMsec(struct timeval t1, struct timeval t2)
Definition: gadgets.cc:51
const char * getMyHostname(void)
Definition: tools.cc:467
void debug_trap(const char *message)
Definition: tools.cc:458
void IRCB(CachePeer *, peer_t, AnyP::ProtocolType, void *, void *data)
Definition: typedefs.h:22

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors