From 19cb79da51e4520c71e8a6c1ab91eeb91033f6e6 Mon Sep 17 00:00:00 2001 From: benStre Date: Sun, 11 Feb 2024 01:49:51 +0100 Subject: [PATCH] change socket priority sorting order --- network/communication-hub.ts | 6 +++--- runtime/runtime.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/network/communication-hub.ts b/network/communication-hub.ts index 90883a26..1c181179 100644 --- a/network/communication-hub.ts +++ b/network/communication-hub.ts @@ -472,12 +472,12 @@ export class CommunicationHubHandler { new Map( // sort by direct/indirect, direct first this.sortGrouped(sockets, ([socket]) => socket.endpoint === endpoint ? 0 : 1, 1) - .map(sockets => - // sort by channelFactor, highest first - this.sortGrouped(sockets, ([socket]) => socket.channelFactor, -1) .map(sockets => // sort by distance, smallest first this.sortGrouped(sockets, ([_, {distance}]) => distance, 1) + .map(sockets => + // sort by channelFactor, highest first + this.sortGrouped(sockets, ([socket]) => socket.channelFactor, -1) .map(sockets => // sort by knownSince, newest (highest) first this.sortGrouped(sockets, ([_, {knownSince}]) => knownSince, -1) diff --git a/runtime/runtime.ts b/runtime/runtime.ts index 40a0a9b3..0dd4b65f 100644 --- a/runtime/runtime.ts +++ b/runtime/runtime.ts @@ -1078,7 +1078,7 @@ export class Runtime { .then(finish) .catch(e => { if (wait_for_result) reject(e); - else logger.debug("Error sending datex block to " + [...to].map(t=>t.toString()).join(", ")); + else logger.debug("Error sending datex block to " + [...to].map(t=>t.toString()).join(", ") + ": " + e.message); }); }