Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-2067

TcpStreamFactory.ConnectAsync should use Socket.ConnectAsync

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.7.1
    • Affects Version/s: 2.4.4
    • Component/s: Connectivity
    • None

      When TcpStreamFactory.ConnectAsync was first implemented the .NET Core implementation of Socket did not have a ConnectAsync method so it was simulated by using Task.Run.

      Our current dependency for the .NET Standard artifacts of the .NET driver is on .NET Standard 1.5, which does support Socket.ConnectAsync.

      So we can update our code to use Socket.ConnectAsync now that it is available.

      Note: see pull request.

      Original Description

      I have a project with xunit and dotnetcore, and during unit testing I have the below exception only if

      1) I use not localhost but the IP of the machine
      2) I use multithread testing (if I execute unit test sequentially everyting is ok).

      I've debugged the driver and I'll submit a pull request.

      A timeout occured after 30000ms selecting a server using CompositeServerSelector{ Selectors = WritableServerSelector, LatencyLimitingServerSelector

      { AllowedLatencyRange = 00:00:00.0150000 }

      }. Client view of cluster state is { ClusterId : "1", ConnectionMode : "Automatic", Type : "Unknown", State : "Disconnected", Servers : [{ ServerId: "

      { ClusterId : 1, EndPoint : "10.0.0.40:27017" }

      ", EndPoint: "10.0.0.40:27017", State: "Disconnected", Type: "Unknown" }] }.

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            alkampfer@nablasoft.com Gian Maria Ricci
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: