summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@gmail.com>2019-09-02 21:35:39 +0900
committerFUJITA Tomonori <fujita.tomonori@gmail.com>2019-09-02 21:35:39 +0900
commit07e70de118842609a8e1e4740fdb82179f4bdaca (patch)
treede6b9a1b21a68a622ea6bf5a8c3126a4058277f5
parenta2ecd78e9fc92d09a889d05c14ed9fdf99218a06 (diff)
server: fix mrt injection race
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
-rw-r--r--pkg/server/grpc_server.go2
-rw-r--r--pkg/server/server.go7
2 files changed, 8 insertions, 1 deletions
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 {