diff options
author | Miguel Herranz <miguel@ipglider.org> | 2017-01-18 18:53:11 +0100 |
---|---|---|
committer | Miguel Herranz <miguel@ipglider.org> | 2017-01-18 21:41:52 +0100 |
commit | cbcdf8ad35a0404141ba08350449647449abd0c0 (patch) | |
tree | 83b18dd315fc641833f6ccc62c8a7f55fb973f21 | |
parent | Merge pull request #1559 (diff) | |
download | monero-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.
-rw-r--r-- | src/p2p/net_peerlist.h | 6 |
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; } |