diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/server.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/server/server.go b/server/server.go index 8867186c..18c2693e 100644 --- a/server/server.go +++ b/server/server.go @@ -1638,10 +1638,9 @@ func (server *BgpServer) handleGrpc(grpcReq *GrpcRequest) []*SenderMsg { } close(grpcReq.ResponseCh) case REQ_MOD_DEFINED_SET: - if err := server.handleGrpcModDefinedSet(grpcReq); err != nil { - grpcReq.ResponseCh <- &GrpcResponse{ - ResponseErr: err, - } + err := server.handleGrpcModDefinedSet(grpcReq) + grpcReq.ResponseCh <- &GrpcResponse{ + ResponseErr: err, } close(grpcReq.ResponseCh) case REQ_POLICY_ROUTEPOLICY, REQ_POLICY_ROUTEPOLICIES: @@ -1698,6 +1697,7 @@ func (server *BgpServer) handleGrpcGetDefinedSet(grpcReq *GrpcRequest) error { if !ok { return fmt.Errorf("invalid defined-set type: %d", typ) } + found := false for _, s := range set { if name != "" && name != s.Name() { continue @@ -1705,10 +1705,14 @@ func (server *BgpServer) handleGrpcGetDefinedSet(grpcReq *GrpcRequest) error { grpcReq.ResponseCh <- &GrpcResponse{ Data: s.ToApiStruct(), } + found = true if name != "" { break } } + if !found { + return fmt.Errorf("not found %s", name) + } return nil } |