diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-07-26 15:35:41 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-07-26 15:35:41 +0900 |
commit | e7354de8bbc20bc507723dc185940f7368723ca4 (patch) | |
tree | 156e74ae7c307747c6fb6be295f491ad6c486f7c /server/server.go | |
parent | 5aea2d93fd6fa41cef42cfb311e4b185725672ac (diff) |
move gRPC-related code for REQ_GET_SERVER to grpc_server.go
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/server.go')
-rw-r--r-- | server/server.go | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/server/server.go b/server/server.go index 15bd90de..17d42ce5 100644 --- a/server/server.go +++ b/server/server.go @@ -1361,12 +1361,6 @@ func (server *BgpServer) handleGrpc(grpcReq *GrpcRequest) { var err error switch grpcReq.RequestType { - case REQ_GET_SERVER: - g := server.bgpConfig.Global - grpcReq.ResponseCh <- &GrpcResponse{ - Data: &g, - } - close(grpcReq.ResponseCh) case REQ_GLOBAL_RIB, REQ_LOCAL_RIB: arg := grpcReq.Data.(*api.GetRibRequest) rib := server.globalRib @@ -1717,6 +1711,19 @@ ERROR: return } +func (s *BgpServer) GetServer() (c *config.Global) { + ch := make(chan struct{}) + defer func() { <-ch }() + + s.mgmtCh <- func() { + defer close(ch) + + g := s.bgpConfig.Global + c = &g + } + return c +} + func (s *BgpServer) GetNeighbor() (l []*config.Neighbor) { ch := make(chan struct{}) defer func() { <-ch }() |