diff options
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 }() |