~ubuntu-branches/ubuntu/intrepid/squid/intrepid

« back to all changes in this revision

Viewing changes to src/peer_select.c

  • Committer: Bazaar Package Importer
  • Date: 2008-07-07 01:10:49 UTC
  • mfrom: (1.1.15 upstream) (7.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080707011049-mcuh21zh500jkdiu
Tags: 2.7.STABLE3-1ubuntu1
Import packaging changes for version 2.7.STABLE3-1ubuntu1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
 
2
2
/*
3
 
 * $Id: peer_select.c,v 1.134.2.1 2008/05/04 23:23:13 hno Exp $
 
3
 * $Id: peer_select.c,v 1.134.2.3 2008/06/24 22:53:49 hno Exp $
4
4
 *
5
5
 * DEBUG: section 44    Peer Selection Algorithm
6
6
 * AUTHOR: Duane Wessels
392
392
    }
393
393
    if (code != HIER_NONE) {
394
394
        assert(p);
395
 
        debug(44, 3) ("peerGetSomeNeighbor: %s/%s\n", hier_strings[code], p->host);
 
395
        debug(44, 3) ("peerGetSomeNeighbor: %s/%s\n", hier_strings[code], p->name);
396
396
        peerAddFwdServer(&ps->servers, p, code);
397
397
    }
398
398
    entry->ping_status = PING_DONE;
433
433
        code = FIRST_PARENT_MISS;
434
434
    }
435
435
    if (p && code != HIER_NONE) {
436
 
        debug(44, 3) ("peerGetSomeNeighborReplies: %s/%s\n", hier_strings[code], p->host);
 
436
        debug(44, 3) ("peerGetSomeNeighborReplies: %s/%s\n", hier_strings[code], p->name);
437
437
        peerAddFwdServer(&ps->servers, p, code);
438
438
    }
439
439
}
484
484
        code = ANY_OLD_PARENT;
485
485
    }
486
486
    if (code != HIER_NONE) {
487
 
        debug(44, 3) ("peerGetSomeParent: %s/%s\n", hier_strings[code], p->host);
 
487
        debug(44, 3) ("peerGetSomeParent: %s/%s\n", hier_strings[code], p->name);
488
488
        peerAddFwdServer(&ps->servers, p, code);
489
489
    }
490
490
}
505
505
            continue;
506
506
        if (!peerHTTPOkay(p, request))
507
507
            continue;
508
 
        debug(15, 3) ("peerGetAllParents: adding alive parent %s\n", p->host);
 
508
        debug(15, 3) ("peerGetAllParents: adding alive parent %s\n", p->name);
509
509
        peerAddFwdServer(&ps->servers, p, ANY_OLD_PARENT);
510
510
    }
511
511
    /* XXX: should add dead parents here, but it is currently
680
680
void
681
681
peerAddFwdServer(FwdServer ** FS, peer * p, hier_code code)
682
682
{
683
 
    FwdServer *fs = memAllocate(MEM_FWD_SERVER);
 
683
    FwdServer *fs;
684
684
    debug(44, 5) ("peerAddFwdServer: adding %s %s\n",
685
 
        p ? p->host : "DIRECT",
 
685
        p ? p->name : "DIRECT",
686
686
        hier_strings[code]);
 
687
    while (*FS) {
 
688
        if ((*FS)->peer == p) {
 
689
            debug(44, 5) ("peerAddFwdServer: Skipping duplicate registration of %s\n", p ? p->name : "DIRECT");
 
690
            return;
 
691
        }
 
692
        FS = &(*FS)->next;
 
693
    }
 
694
    fs = memAllocate(MEM_FWD_SERVER);
687
695
    fs->peer = p;
688
696
    fs->code = code;
689
697
    cbdataLock(fs->peer);
690
 
    while (*FS)
691
 
        FS = &(*FS)->next;
692
698
    *FS = fs;
693
699
}