Skip to content

Commit

Permalink
change socket priority sorting order
Browse files Browse the repository at this point in the history
  • Loading branch information
benStre committed Feb 11, 2024
1 parent 265abd9 commit 19cb79d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions network/communication-hub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion runtime/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

}
Expand Down

0 comments on commit 19cb79d

Please sign in to comment.