From 5261bac1d8d8567489822b43dedc03dcdd04a12f Mon Sep 17 00:00:00 2001 From: Arceliar Date: Wed, 4 Jul 2018 21:43:42 -0500 Subject: [PATCH] cleanup --- src/yggdrasil/switch.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/yggdrasil/switch.go b/src/yggdrasil/switch.go index ff2229c5..05aa18c5 100644 --- a/src/yggdrasil/switch.go +++ b/src/yggdrasil/switch.go @@ -589,7 +589,6 @@ func (t *switchTable) handleIn(packet []byte, idle map[switchPort]struct{}) bool // Info about a buffered packet type switch_packetInfo struct { bytes []byte - //time time.Time // Timestamp of when the packet arrived } // Used to keep track of buffered packets @@ -600,7 +599,7 @@ type switch_buffer struct { // Clean up old packets from buffers, to help keep latency within some reasonable bound func (t *switchTable) cleanBuffer(b *switch_buffer) { - // TODO sane maximum buffer size, or else CoDel-like maximum time + // TODO sane maximum buffer size, or else CoDel-like maximum time for len(b.packets) > 32 || (len(b.packets) > 0 && t.selfIsClosest(switch_getPacketCoords(b.packets[0].bytes))) { util_putBytes(b.packets[0].bytes) b.packets = b.packets[1:] @@ -634,12 +633,10 @@ func (t *switchTable) handleIdle(port switchPort, buffs map[string]switch_buffer } } if bestSize != 0 { - t.core.log.Println("DEBUG:", []byte(best), bestSize) buf := buffs[best] var packet switch_packetInfo // TODO decide if this should be LIFO or FIFO packet, buf.packets = buf.packets[0], buf.packets[1:] - //buf.count-- // Force flooding connections to eventually yield if len(buf.packets) == 0 { delete(buffs, best) } else { @@ -676,7 +673,7 @@ func (t *switchTable) doWorker() { streamID := switch_getPacketStreamID(packet) buf := buffs[streamID] t.cleanBuffer(&buf) - pinfo := switch_packetInfo{packet/*, time.Now()*/} + pinfo := switch_packetInfo{packet} buf.packets = append(buf.packets, pinfo) buf.count++ buffs[streamID] = buf