Skip to content

Commit

Permalink
Edit tests, add comments
Browse files Browse the repository at this point in the history
Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>
  • Loading branch information
Vladimir Popov committed Feb 11, 2021
1 parent 8635adb commit a6affcc
Show file tree
Hide file tree
Showing 2 changed files with 285 additions and 189 deletions.
6 changes: 3 additions & 3 deletions pkg/networkservice/common/connect/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ type connectionInfo struct {
client *clientInfo
}

// NewServer - chain element that
// NewServer - server chain element that creates client subchains and requests them selecting by
// clienturlctx.ClientURL(ctx)
func NewServer(
ctx context.Context,
clientFactory func(ctx context.Context, cc grpc.ClientConnInterface) networkservice.NetworkServiceClient,
Expand All @@ -85,7 +86,7 @@ func (s *connectServer) Request(ctx context.Context, request *networkservice.Net
s.closeClient(clientInfo, clientURL.String())
}

// close current client chain if grpc connection was closed
// Close current client chain if grpc connection was closed
if grpcutils.UnwrapCode(err) == codes.Canceled {
s.deleteClient(clientInfo, clientURL.String())
s.connInfos.Delete(request.GetConnection().GetId())
Expand Down Expand Up @@ -158,7 +159,6 @@ func (s *connectServer) client(ctx context.Context, conn *networkservice.Connect
return client
}

// newClient has to be called under clientsMutex protection
func (s *connectServer) newClient(clientURL *url.URL) *clientInfo {
ctx, cancel := context.WithCancel(s.ctx)
client := clienturl.NewClient(clienturlctx.WithClientURL(ctx, clientURL), s.clientFactory, s.clientDialOptions...)
Expand Down
Loading

0 comments on commit a6affcc

Please sign in to comment.