~chtsanti/squid/icap-max-connections

« back to all changes in this revision

Viewing changes to src/peer_digest.cc

  • Committer: Christos Tsantilas
  • Date: 2009-02-18 22:18:35 UTC
  • mfrom: (9294.1.215 trunk)
  • Revision ID: chtsanti@users.sourceforge.net-20090218221835-lfxxe3bs8uhu0b1h
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
231
231
{
232
232
    eventAdd("peerDigestCheck", peerDigestCheck, pd, (double) delay, 1);
233
233
    pd->times.next_check = squid_curtime + delay;
234
 
    debugs(72, 3, "peerDigestSetCheck: will check peer " << pd->host.unsafeBuf() << " in " << delay << " secs");
 
234
    debugs(72, 3, "peerDigestSetCheck: will check peer " << pd->host << " in " << delay << " secs");
235
235
}
236
236
 
237
237
/*
241
241
peerDigestNotePeerGone(PeerDigest * pd)
242
242
{
243
243
    if (pd->flags.requested) {
244
 
        debugs(72, 2, "peerDigest: peer " << pd->host.unsafeBuf() << " gone, will destroy after fetch.");
 
244
        debugs(72, 2, "peerDigest: peer " << pd->host << " gone, will destroy after fetch.");
245
245
        /* do nothing now, the fetching chain will notice and take action */
246
246
    } else {
247
 
        debugs(72, 2, "peerDigest: peer " << pd->host.unsafeBuf() << " is gone, destroying now.");
 
247
        debugs(72, 2, "peerDigest: peer " << pd->host << " is gone, destroying now.");
248
248
        peerDigestDestroy(pd);
249
249
    }
250
250
}
279
279
    /* per-peer limit */
280
280
 
281
281
    if (req_time - pd->times.received < PeerDigestReqMinGap) {
282
 
        debugs(72, 2, "peerDigestCheck: " << pd->host.unsafeBuf() <<
 
282
        debugs(72, 2, "peerDigestCheck: " << pd->host <<
283
283
               ", avoiding close peer requests (" <<
284
284
               (int) (req_time - pd->times.received) << " < " <<
285
285
               (int) PeerDigestReqMinGap << " secs).");
289
289
 
290
290
    /* global limit */
291
291
    if (req_time - pd_last_req_time < GlobDigestReqMinGap) {
292
 
        debugs(72, 2, "peerDigestCheck: " << pd->host.unsafeBuf() <<
 
292
        debugs(72, 2, "peerDigestCheck: " << pd->host <<
293
293
               ", avoiding close requests (" <<
294
294
               (int) (req_time - pd_last_req_time) << " < " <<
295
295
               (int) GlobDigestReqMinGap << " secs).");
544
544
        assert(reply);
545
545
        assert (reply->sline.status != 0);
546
546
        status = reply->sline.status;
547
 
        debugs(72, 3, "peerDigestFetchReply: " << pd->host.unsafeBuf() << " status: " << status <<
 
547
        debugs(72, 3, "peerDigestFetchReply: " << pd->host << " status: " << status <<
548
548
               ", expires: " << (long int) reply->expires << " (" << std::showpos <<
549
549
               (int) (reply->expires - squid_curtime) << ")");
550
550
 
634
634
        assert (fetch->entry->getReply()->sline.status != 0);
635
635
 
636
636
        if (fetch->entry->getReply()->sline.status != HTTP_OK) {
637
 
            debugs(72, 1, "peerDigestSwapInHeaders: " << fetch->pd->host.unsafeBuf() <<
 
637
            debugs(72, 1, "peerDigestSwapInHeaders: " << fetch->pd->host <<
638
638
                   " status " << fetch->entry->getReply()->sline.status <<
639
639
                   " got cached!");
640
640
 
762
762
#endif
763
763
 
764
764
        else
765
 
            host = pd->host.unsafeBuf();
 
765
            host = pd->host.termedBuf();
766
766
    }
767
767
 
768
768
    debugs(72, 6, step_name << ": peer " << host << ", offset: " <<
813
813
peerDigestFetchStop(DigestFetchState * fetch, char *buf, const char *reason)
814
814
{
815
815
    assert(reason);
816
 
    debugs(72, 2, "peerDigestFetchStop: peer " << fetch->pd->host.unsafeBuf() << ", reason: " << reason);
 
816
    debugs(72, 2, "peerDigestFetchStop: peer " << fetch->pd->host << ", reason: " << reason);
817
817
    peerDigestReqFinish(fetch, buf, 1, 1, 1, reason, 0);
818
818
}
819
819
 
822
822
peerDigestFetchAbort(DigestFetchState * fetch, char *buf, const char *reason)
823
823
{
824
824
    assert(reason);
825
 
    debugs(72, 2, "peerDigestFetchAbort: peer " << fetch->pd->host.unsafeBuf() << ", reason: " << reason);
 
825
    debugs(72, 2, "peerDigestFetchAbort: peer " << fetch->pd->host << ", reason: " << reason);
826
826
    peerDigestReqFinish(fetch, buf, 1, 1, 1, reason, 1);
827
827
}
828
828
 
872
872
peerDigestPDFinish(DigestFetchState * fetch, int pcb_valid, int err)
873
873
{
874
874
    PeerDigest *pd = fetch->pd;
875
 
    const char *host = pd->host.unsafeBuf();
 
875
    const char *host = pd->host.termedBuf();
876
876
 
877
877
    pd->times.received = squid_curtime;
878
878
    pd->times.req_delay = fetch->resp_time;
986
986
{
987
987
    StoreDigestCBlock cblock;
988
988
    int freed_size = 0;
989
 
    const char *host = pd->host.unsafeBuf();
 
989
    const char *host = pd->host.termedBuf();
990
990
 
991
991
    xmemcpy(&cblock, buf, sizeof(cblock));
992
992
    /* network -> host conversions */
1080
1080
    const int bit_util = cacheDigestBitUtil(pd->cd);
1081
1081
 
1082
1082
    if (bit_util > 65) {
1083
 
        debugs(72, 0, "Warning: " << pd->host.unsafeBuf() <<
 
1083
        debugs(72, 0, "Warning: " << pd->host <<
1084
1084
               " peer digest has too many bits on (" << bit_util << "%%).");
1085
1085
 
1086
1086
        return 0;
1106
1106
 
1107
1107
    assert(pd);
1108
1108
 
1109
 
    const char *host = pd->host.unsafeBuf();
 
1109
    const char *host = pd->host.termedBuf();
1110
1110
    storeAppendPrintf(e, "\npeer digest from %s\n", host);
1111
1111
 
1112
1112
    cacheDigestGuessStatsReport(&pd->stats.guess, e, host);