Skip to content

Commit

Permalink
[qfix] Some minor fixes for NSE Unregister scenario (#1568)
Browse files Browse the repository at this point in the history
* [qfix] Pass grpc options to the next chain element in clientConnNSEClient

Signed-off-by: Nikita Skrynnik <nikita.skrynnik@xored.com>

* do not delete nse from localbypass.nseURLs if unregister fails

Signed-off-by: Nikita Skrynnik <nikita.skrynnik@xored.com>

* apply review comments

Signed-off-by: Nikita Skrynnik <nikita.skrynnik@xored.com>

---------

Signed-off-by: Nikita Skrynnik <nikita.skrynnik@xored.com>
  • Loading branch information
NikitaSkrynnik authored Dec 21, 2023
1 parent 1979cc1 commit 565471f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/registry/common/clientconn/nse_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (c *clientConnNSEClient) Register(ctx context.Context, in *registry.Network

func (c *clientConnNSEClient) Unregister(ctx context.Context, in *registry.NetworkServiceEndpoint, opts ...grpc.CallOption) (*empty.Empty, error) {
ctx = withClientConnMetadata(ctx, &c.Map, in.GetName())
return next.NetworkServiceEndpointRegistryClient(ctx).Unregister(ctx, in)
return next.NetworkServiceEndpointRegistryClient(ctx).Unregister(ctx, in, opts...)
}

func (c *clientConnNSEClient) Find(ctx context.Context, in *registry.NetworkServiceEndpointQuery, opts ...grpc.CallOption) (registry.NetworkServiceEndpointRegistry_FindClient, error) {
Expand Down
5 changes: 3 additions & 2 deletions pkg/registry/common/localbypass/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ func (s *localBypassNSEServer) Unregister(ctx context.Context, nse *registry.Net
nse.Url = s.nsmgrURL

_, err = next.NetworkServiceEndpointRegistryServer(ctx).Unregister(ctx, nse)

s.nseURLs.Delete(nse.Name)
if err == nil {
s.nseURLs.Delete(nse.Name)
}
}
return new(empty.Empty), err
}

0 comments on commit 565471f

Please sign in to comment.