From 5d3c9540eea7cf1ff9427df6995427697fb2629b Mon Sep 17 00:00:00 2001 From: cel Date: Tue, 11 Apr 2017 17:59:24 -0700 Subject: Fix peer sorting --- lib/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/app.js') diff --git a/lib/app.js b/lib/app.js index b3cd1b1..8ac01d6 100644 --- a/lib/app.js +++ b/lib/app.js @@ -182,8 +182,8 @@ var stateVals = { function comparePeers(a, b) { var aState = stateVals[a.state] || 0 var bState = stateVals[b.state] || 0 - return bState > aState ? 1 : bState < aState ? -1 : - b.stateChange - a.stateChange + return (bState - aState) + || (b.stateChange|0 - a.stateChange|0) } App.prototype.streamPeers = function (opts) { -- cgit v1.2.3