From c573170886a85e9a88fe3d8e770949ccfd78c4ea Mon Sep 17 00:00:00 2001 From: Arceliar Date: Sat, 24 Aug 2019 15:27:56 -0500 Subject: [PATCH] remove switch doworker loop, start a dummy loop to respond to (unused) reconfiguration instead --- src/yggdrasil/switch.go | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/yggdrasil/switch.go b/src/yggdrasil/switch.go index 20552ae0..905f2a79 100644 --- a/src/yggdrasil/switch.go +++ b/src/yggdrasil/switch.go @@ -566,7 +566,12 @@ func (t *switchTable) getTable() lookupTable { // Starts the switch worker func (t *switchTable) start() error { t.core.log.Infoln("Starting switch") - go t.doWorker() + go func() { + // TODO find a better way to handle reconfiguration... and have the switch do something with the new configuration + for ch := range t.reconfigure { + ch <- nil + } + }() return nil } @@ -865,17 +870,6 @@ func (t *switchTable) _idleIn(port switchPort) { } } -// The switch worker does routing lookups and sends packets to where they need to be -func (t *switchTable) doWorker() { - for { - //t.core.log.Debugf("Switch state: idle = %d, buffers = %d", len(idle), len(t.queues.bufs)) - select { - case e := <-t.reconfigure: - e <- nil - } - } -} - // Passed a function to call. // This will send the function to t.admin and block until it finishes. func (t *switchTable) doAdmin(f func()) {