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 | 2a2f02e375d0db176b998af779e447ffe871b774 (diff) | |
| download | monzero-core-cbcdf8ad35a0404141ba08350449647449abd0c0.tar.gz monzero-core-cbcdf8ad35a0404141ba08350449647449abd0c0.tar.xz monzero-core-cbcdf8ad35a0404141ba08350449647449abd0c0.zip | |
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; } |
