From c6edf8421f876d11da5677fb666257edebf896e2 Mon Sep 17 00:00:00 2001 From: David Wragg Date: Mon, 27 Jul 2015 16:33:21 +0100 Subject: [PATCH] Handle the not-found case implicitly in Broadcast and BroadcastAll --- router/routes.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/router/routes.go b/router/routes.go index b463b658..50705635 100644 --- a/router/routes.go +++ b/router/routes.go @@ -65,21 +65,13 @@ func (routes *Routes) UnicastAll(name PeerName) (PeerName, bool) { func (routes *Routes) Broadcast(name PeerName) []PeerName { routes.RLock() defer routes.RUnlock() - hops, found := routes.broadcast[name] - if !found { - return []PeerName{} - } - return hops + return routes.broadcast[name] } func (routes *Routes) BroadcastAll(name PeerName) []PeerName { routes.RLock() defer routes.RUnlock() - hops, found := routes.broadcastAll[name] - if !found { - return []PeerName{} - } - return hops + return routes.broadcastAll[name] } // Choose min(log2(n_peers), n_neighbouring_peers) neighbours, with a