diff options
-rw-r--r-- | server/grpc_server.go | 12 | ||||
-rw-r--r-- | server/server.go | 14 |
2 files changed, 13 insertions, 13 deletions
diff --git a/server/grpc_server.go b/server/grpc_server.go index 1ad4735a..17605f82 100644 --- a/server/grpc_server.go +++ b/server/grpc_server.go @@ -686,7 +686,17 @@ func (s *Server) GetServer(ctx context.Context, arg *api.GetServerRequest) (*api if err != nil { return nil, err } - return d.(*api.GetServerResponse), err + g := d.(*config.Global) + return &api.GetServerResponse{ + Global: &api.Global{ + As: g.Config.As, + RouterId: g.Config.RouterId, + ListenPort: g.Config.Port, + ListenAddresses: g.Config.LocalAddressList, + MplsLabelMin: g.MplsLabelRange.MinLabel, + MplsLabelMax: g.MplsLabelRange.MaxLabel, + }, + }, err } func (s *Server) StartServer(ctx context.Context, arg *api.StartServerRequest) (*api.StartServerResponse, error) { diff --git a/server/server.go b/server/server.go index 0642619b..d5a51c44 100644 --- a/server/server.go +++ b/server/server.go @@ -1528,19 +1528,9 @@ func (server *BgpServer) handleGrpc(grpcReq *GrpcRequest) { switch grpcReq.RequestType { case REQ_GET_SERVER: g := server.bgpConfig.Global - result := &GrpcResponse{ - Data: &api.GetServerResponse{ - Global: &api.Global{ - As: g.Config.As, - RouterId: g.Config.RouterId, - ListenPort: g.Config.Port, - ListenAddresses: g.Config.LocalAddressList, - MplsLabelMin: g.MplsLabelRange.MinLabel, - MplsLabelMax: g.MplsLabelRange.MaxLabel, - }, - }, + grpcReq.ResponseCh <- &GrpcResponse{ + Data: &g, } - grpcReq.ResponseCh <- result close(grpcReq.ResponseCh) case REQ_START_SERVER: err := server.handleModConfig(grpcReq) |