make route calculcation more efficient and properly async

Instead of following the usual actor pattern, we use a 1-place channel
with a non-blocking send. Essentially, if there is already a pending
recalculation request queued up, there is no point enqueuing another
one.
This commit is contained in:
Matthias Radestock committed 2015-04-03 18:12:03 +01:00
1 parent acbb911823
commit 7166d151aa
2 files changed
+18 -23

No files matched your search

+1 -1
View File
@@ -21,7 +21,7 @@ type mockChannelConnection struct {
func NewTestRouter(name PeerName) *Router {
router := NewRouter(nil, name, "", nil, 10, 1024, nil)
router.ConnectionMaker.actionChan = make(chan ConnectionMakerAction, ChannelSize)
router.Routes.actionChan = make(chan RoutesAction, ChannelSize)
router.Routes.recalculate = make(chan *struct{}, 1)
return router
}