From 07e70de118842609a8e1e4740fdb82179f4bdaca Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Mon, 2 Sep 2019 21:35:39 +0900 Subject: server: fix mrt injection race Signed-off-by: FUJITA Tomonori --- pkg/server/grpc_server.go | 2 +- pkg/server/server.go | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'pkg') diff --git a/pkg/server/grpc_server.go b/pkg/server/grpc_server.go index 2540e685..725ab77a 100644 --- a/pkg/server/grpc_server.go +++ b/pkg/server/grpc_server.go @@ -360,7 +360,7 @@ func (s *server) AddPathStream(stream api.GobgpApi_AddPathStreamServer) error { pathList = append(pathList, path) } } - err = s.bgpServer.addPathList(arg.VrfId, pathList) + err = s.bgpServer.addPathStream(arg.VrfId, pathList) if err != nil { return err } diff --git a/pkg/server/server.go b/pkg/server/server.go index 16b6e869..e92155b8 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -1969,6 +1969,13 @@ func (s *BgpServer) addPathList(vrfId string, pathList []*table.Path) error { return err } +func (s *BgpServer) addPathStream(vrfId string, pathList []*table.Path) error { + err := s.mgmtOperation(func() error { + return s.addPathList(vrfId, pathList) + }, true) + return err +} + func (s *BgpServer) AddPath(ctx context.Context, r *api.AddPathRequest) (*api.AddPathResponse, error) { var uuidBytes []byte err := s.mgmtOperation(func() error { -- cgit v1.2.3