From 03949dcf3f4fd431d98bc619c20bfc84ec35c53e Mon Sep 17 00:00:00 2001 From: Arceliar Date: Sun, 24 Jun 2018 18:05:00 -0500 Subject: [PATCH] fix my terrible bug, I have no idea why the old one even worked --- src/yggdrasil/switch.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/yggdrasil/switch.go b/src/yggdrasil/switch.go index 4b3c2118..e5db8ca9 100644 --- a/src/yggdrasil/switch.go +++ b/src/yggdrasil/switch.go @@ -624,8 +624,10 @@ func (t *switchTable) handleIdle(port switchPort, stacks map[string][][]byte) bo var bestSize int for streamID, packets := range stacks { // Filter over the streams that this node is closer to + // Keep the one with the smallest queue packet := packets[len(packets)-1] - if (bestSize == 0 || len(packets) < bestSize) && t.portIsCloser(packet, port) { + coords := switch_getPacketCoords(packet) + if (bestSize == 0 || len(packets) < bestSize) && t.portIsCloser(coords, port) { best = streamID bestSize = len(packets) }