weird scheduler hack, seems to tend to make things more stable without actually locking streams to any particular link

This commit is contained in:
Arceliar 2019-09-21 14:33:45 -05:00
parent 2a76163c7e
commit 691192ff5a
2 changed files with 11 additions and 5 deletions

View file

@ -712,10 +712,15 @@ func (t *switchTable) _handleIn(packet []byte, idle map[switchPort]struct{}) boo
}
}
if best != nil {
// Send to the best idle next hop
delete(idle, best.elem.port)
ports[best.elem.port].sendPacketsFrom(t, [][]byte{packet})
return true
// Tell ourselves to send to this node later
// If another (e.g. even better) hop becomes idle in the mean time, it'll take the packet instead
// FIXME this is just a hack, but seems to help with stability...
go t.Act(nil, func() {
t._idleIn(best.elem.port)
})
//ports[best.elem.port].sendPacketsFrom(t, [][]byte{packet})
//return true
}
// Didn't find anyone idle to send it to
return false