From 1c14af0ab4f34bc134c68e98493e6a43bdef3848 Mon Sep 17 00:00:00 2001 From: Richard Nyberg Date: Mon, 16 Jan 2006 19:47:05 +0000 Subject: [PATCH] Add peer_full function. --- btpd/peer.c | 6 ++++++ btpd/peer.h | 1 + 2 files changed, 7 insertions(+) diff --git a/btpd/peer.c b/btpd/peer.c index 2b06a9f..1b8f344 100644 --- a/btpd/peer.c +++ b/btpd/peer.c @@ -550,3 +550,9 @@ peer_active_up(struct peer *p) return (p->flags & (PF_P_WANT|PF_I_CHOKE)) == PF_P_WANT || p->npiece_msgs > 0; } + +int +peer_full(struct peer *p) +{ + return p->npieces == p->n->tp->meta.npieces; +} diff --git a/btpd/peer.h b/btpd/peer.h index 0921438..afc5cf0 100644 --- a/btpd/peer.h +++ b/btpd/peer.h @@ -60,5 +60,6 @@ int peer_wanted(struct peer *p); int peer_laden(struct peer *p); int peer_has(struct peer *p, uint32_t index); int peer_leech_ok(struct peer *p); +int peer_full(struct peer *p); #endif