From 8fdc050e2eeafb2a6dec379e7a7fa975f330937e Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Mon, 29 Jul 2019 12:44:28 +0100 Subject: [PATCH] syntactic changes --- network/router/default.go | 2 +- network/router/table.go | 2 +- network/router/watcher.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/network/router/default.go b/network/router/default.go index aa31688d..b1170796 100644 --- a/network/router/default.go +++ b/network/router/default.go @@ -41,6 +41,7 @@ var ( // router implements default router type router struct { + sync.RWMutex // embed the table *table opts Options @@ -51,7 +52,6 @@ type router struct { advertChan chan *Advert advertWg *sync.WaitGroup wg *sync.WaitGroup - sync.RWMutex } // newRouter creates new router and returns it diff --git a/network/router/table.go b/network/router/table.go index f9cfd23d..78c02c7c 100644 --- a/network/router/table.go +++ b/network/router/table.go @@ -17,11 +17,11 @@ var ( // table is an in memory routing table type table struct { + sync.RWMutex // routes stores service routes routes map[string]map[uint64]Route // watchers stores table watchers watchers map[string]*tableWatcher - sync.RWMutex } // newtable creates a new routing table and returns it diff --git a/network/router/watcher.go b/network/router/watcher.go index d41b527c..1530e72c 100644 --- a/network/router/watcher.go +++ b/network/router/watcher.go @@ -71,10 +71,10 @@ func WatchService(s string) WatchOption { } type tableWatcher struct { + sync.RWMutex opts WatchOptions resChan chan *Event done chan struct{} - sync.RWMutex } // Next returns the next noticed action taken on table