diff --git a/gnmi_server/client_subscribe.go b/gnmi_server/client_subscribe.go index bf791e79..2207bd30 100644 --- a/gnmi_server/client_subscribe.go +++ b/gnmi_server/client_subscribe.go @@ -179,12 +179,13 @@ func (c *Client) Run(stream gnmipb.GNMI_SubscribeServer) (err error) { /* For any other target or no target create new Transl Client. */ dc, err = sdc.NewTranslClient(prefix, paths, ctx, extensions, sdc.TranslWildcardOption{}) } - defer dc.Close() if err != nil { return grpc.Errorf(codes.NotFound, "%v", err) } + defer dc.Close() + switch mode { case gnmipb.SubscriptionList_STREAM: c.stop = make(chan struct{}, 1)