* [Bug 1660] from 4.2.6p3-RC3: On some systems, test is in /usr/bin, not
/bin.
* [Bug 1661] from 4.2.6p3-RC3: Re-indent refclock_ripencc.c.
+* Lose peer_count from ntp_peer.c and ntp_proto.c (Dave Mills).
(4.2.7p61) 2010/10/06 Released by Harlan Stenn <stenn@ntp.org>
* Documentation and code cleanup from Dave Mills. No more NTP_MAXASSOC.
(4.2.7p60) 2010/10/04 Released by Harlan Stenn <stenn@ntp.org>
int assoc_hash_count[NTP_HASH_SIZE];/* peers in each bucket */
struct peer *peer_list; /* peer structures list */
static struct peer *peer_free; /* peer structures free list */
-int peer_count; /* count of peer_list */
int peer_free_count; /* count of free structures */
/*
/*
* free_peer - internal routine to free memory referred to by a struct
* peer and return it to the peer free list. If unlink is
- * nonzero, unlink from the various lists and decrement
- * peer_count.
+ * nonzero, unlink from the various lists.
*/
static void
free_peer(
if (NULL == unlinked)
msyslog(LOG_ERR, "%s not in peer list!",
stoa(&p->srcadr));
- else
- peer_count--;
}
if (p->hostname != NULL)
LINK_SLIST(assoc_hash[hash], peer, aid_link);
assoc_hash_count[hash]++;
LINK_SLIST(peer_list, peer, p_link);
- peer_count++;
restrict_source(&peer->srcadr, 0, 0);
-
snprintf(tbuf, sizeof(tbuf), "assoc %d", peer->associd);
report_event(PEVNT_MOBIL, peer, tbuf);
-
DPRINTF(1, ("newpeer: %s->%s mode %u vers %u poll %u %u flags 0x%x 0x%x ttl %u key %08x\n",
latoa(peer->dstadr), stoa(&peer->srcadr), peer->hmode,
peer->version, peer->minpoll, peer->maxpoll, peer->flags,
* Allocate dynamic space depending on the number of
* associations.
*/
- endpoint_size = peer_count * 3 * sizeof(struct endpoint);
- indx_size = peer_count * 3 * sizeof(int);
- peers_size = peer_count * sizeof(struct peer *);
- synch_size = peer_count * sizeof(double);
- error_size = peer_count * sizeof(double);
+ nlist = 0;
+ for (peer = peer_list; peer != NULL; peer = peer->p_link)
+ nlist++;
+ endpoint_size = nlist * 2 * sizeof(struct endpoint);
+ indx_size = nlist * 2 * sizeof(int);
+ peers_size = nlist * sizeof(struct peer *);
+ synch_size = nlist * sizeof(double);
+ error_size = nlist * sizeof(double);
octets = endpoint_size + indx_size + peers_size + synch_size +
error_size;
endpoint = erealloc(endpoint, octets);
e = peer->offset; /* upper end */
f = root_distance(peer);
e = e + f;
+ j = 0;
for (i = nl3 - 1; i >= 0; i--) {
+ j = nl3 - 1 + 2;
if (e >= endpoint[indx[i]].val)
break;