diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-07-20 04:30:34 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-07-20 04:30:34 +0900 |
commit | c7c8f5612bb726ca8fe85389c688bb5d412e8fdb (patch) | |
tree | 4316618085cc5b688d726de14be4cc6c565df1a9 | |
parent | f27afac154c955e1e2508d2443ef29ecfc62c6b8 (diff) |
add management task channel
replace GrpcRequest/Response. Simpler and handy golang-native APIs.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | server/server.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/server/server.go b/server/server.go index 23eba426..09d63259 100644 --- a/server/server.go +++ b/server/server.go @@ -96,6 +96,7 @@ type BgpServer struct { fsmStateCh chan *FsmMsg acceptCh chan *net.TCPConn + mgmtCh chan func() GrpcReqCh chan *GrpcRequest policy *table.RoutingPolicy listeners []*TCPListener @@ -114,6 +115,7 @@ func NewBgpServer() *BgpServer { policy: table.NewRoutingPolicy(), roaManager: roaManager, watchers: newWatcherManager(), + mgmtCh: make(chan func(), 1), } } @@ -216,6 +218,8 @@ func (server *BgpServer) Serve() { CONT: select { + case f := <-server.mgmtCh: + f() case rmsg := <-server.roaManager.ReceiveROA(): server.roaManager.HandleROAEvent(rmsg) case conn := <-server.acceptCh: |