diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-07-05 15:09:19 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-07-20 03:00:24 +0900 |
commit | 1f9a5cb7e5e8aa90b94847cf787433053ba8324c (patch) | |
tree | 0a484caa33a677e66d287e17e1c39b059e545d3e | |
parent | b6e606a99480cffd47e73e7b74aa3a10df5ad47d (diff) |
move gRPC-related code for REQ_GET_SERVER to grpc_server.go
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-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) |