aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Herranz <miguel@ipglider.org>2017-01-18 18:53:11 +0100
committerMiguel Herranz <miguel@ipglider.org>2017-01-18 21:41:52 +0100
commitcbcdf8ad35a0404141ba08350449647449abd0c0 (patch)
tree83b18dd315fc641833f6ccc62c8a7f55fb973f21
parentMerge pull request #1559 (diff)
downloadmonero-cbcdf8ad35a0404141ba08350449647449abd0c0.tar.xz
Honor depth in get_peerlist_head method
The method returned depth + 2 because: - push_back was executed before the condition. - > instead of >= causing one more iteration.
Diffstat (limited to '')
-rw-r--r--src/p2p/net_peerlist.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/p2p/net_peerlist.h b/src/p2p/net_peerlist.h
index fa69abd6e..db9387ceb 100644
--- a/src/p2p/net_peerlist.h
+++ b/src/p2p/net_peerlist.h
@@ -285,9 +285,11 @@ namespace nodetool
{
if(!vl.last_seen)
continue;
- bs_head.push_back(vl);
- if(cnt++ > depth)
+
+ if(cnt++ >= depth)
break;
+
+ bs_head.push_back(vl);
}
return true;
}