Skip to content

Commit

Permalink
Fix stuck on unregistered endpoint
Browse files Browse the repository at this point in the history
Signed-off-by: Artem Belov <artem.belov@xored.com>
  • Loading branch information
Artem Belov committed Mar 9, 2021
1 parent d37f992 commit ade908c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 8 additions & 1 deletion pkg/registry/common/localbypass/find_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@
package localbypass

import (
"errors"

"github.com/networkservicemesh/api/pkg/api/registry"

"github.com/networkservicemesh/sdk/pkg/tools/stringurl"
)

type localBypassNSEFindServer struct {
nseURLs *stringurl.Map
nseURLs *stringurl.Map
nsmgrUrl string

registry.NetworkServiceEndpointRegistry_FindServer
}
Expand All @@ -32,5 +35,9 @@ func (s *localBypassNSEFindServer) Send(endpoint *registry.NetworkServiceEndpoin
if u, ok := s.nseURLs.Load(endpoint.Name); ok {
endpoint.Url = u.String()
}
if endpoint.Url == s.nsmgrUrl {
return errors.New("NSMgr found unregistered endpoint")
}

return s.NetworkServiceEndpointRegistry_FindServer.Send(endpoint)
}
3 changes: 2 additions & 1 deletion pkg/registry/common/localbypass/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ func (s *localBypassNSEServer) Find(query *registry.NetworkServiceEndpointQuery,

func (s *localBypassNSEServer) findServer(server registry.NetworkServiceEndpointRegistry_FindServer) registry.NetworkServiceEndpointRegistry_FindServer {
return &localBypassNSEFindServer{
nseURLs: &s.nseURLs,
nseURLs: &s.nseURLs,
nsmgrUrl: s.url,
NetworkServiceEndpointRegistry_FindServer: server,
}
}
Expand Down

0 comments on commit ade908c

Please sign in to comment.