File tree Expand file tree Collapse file tree 4 files changed +482
-997
lines changed Expand file tree Collapse file tree 4 files changed +482
-997
lines changed Original file line number Diff line number Diff line change @@ -792,7 +792,6 @@ AllTests-mainnet
792
792
+ Access peers by key test OK
793
793
+ Acquire from empty pool OK
794
794
+ Acquire/Sorting and consistency test OK
795
- + Custom filters test OK
796
795
+ Delete peer on release text OK
797
796
+ Iterators test OK
798
797
+ Peer lifetime test OK
Original file line number Diff line number Diff line change @@ -480,12 +480,15 @@ func netKbps*(peer: Peer): float {.inline.} =
480
480
## Returns current network throughput average value in Kbps for peer ``peer``.
481
481
round(((peer.netThroughput.average / 1024) * 10_000) / 10_000)
482
482
483
- # /!\ Must be exported to be seen by `peerpool`.
484
- func cmp*(a, b: Peer): int =
485
- if a.score == b.score:
486
- cmp(a.netThroughput.average, b.netThroughput.average)
483
+ # /!\ Must be exported to be seen by `peerCmp`
484
+ func `<`*(a, b: Peer): bool =
485
+ ## Comparison function indicating `true` if peer `a` ranks worse than peer `b`
486
+ if a.score != b.score:
487
+ a.score < b.score
488
+ elif a.netThroughput.average != b.netThroughput.average:
489
+ a.netThroughput.average < b.netThroughput.average
487
490
else:
488
- cmp(a.score , b.score )
491
+ system.`<`(a , b)
489
492
490
493
const
491
494
maxRequestQuota = 1000000
You can’t perform that action at this time.
0 commit comments