5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-10 06:20:26 +00:00

remove switch doworker loop, start a dummy loop to respond to (unused) reconfiguration instead

This commit is contained in:
Arceliar 2019-08-24 15:27:56 -05:00
parent 998c76fd8c
commit c573170886

View File

@ -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()) {