From 96d68439bb8f5d875835b8950321b09f95a0462f Mon Sep 17 00:00:00 2001 From: Richard Nyberg Date: Thu, 7 Jul 2005 13:21:23 +0000 Subject: [PATCH] Add check so that we don't connect to more peers than we should. --- btpd/tracker_req.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/btpd/tracker_req.c b/btpd/tracker_req.c index b30341e..0e4fe57 100644 --- a/btpd/tracker_req.c +++ b/btpd/tracker_req.c @@ -115,7 +115,8 @@ tracker_done(struct child *child) if (error == EINVAL) { error = benc_dget_str(req->res->buf, "peers", &peers, &length); if (error == 0 && length % 6 == 0) { - for (size_t i = 0; i < length; i += 6) + size_t i; + for (i = 0; i < length && btpd.npeers < btpd.maxpeers; i += 6) peer_create_out_compact(tp, peers + i); } }