Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

.NET Client - Connection Bugs - Release 2.0.0 #2738

Closed
stuarthunter opened this Issue · 3 comments

4 participants

stuarthunter David Fowler Gustavo Armenta Abhishek Nanda
stuarthunter

Hi,

I have identified two bugs in the .NET Client Connection class (src/Microsoft.AspNet.SignalR.Client/Connection.cs).

1 - Start method will clear required references to _connectTask and _disconnectCts if invoked when connection state != Disconnecting.

The fix is to check the connection state before setting references:

public Task Start(IClientTransport transport)
{
    lock (_startLock)
    {
        if (!ChangeState(ConnectionState.Disconnected, ConnectionState.Connecting))
        {
            return TaskAsyncHelper.Empty;
        }

        _disconnectCts = new CancellationTokenSource();
        _monitor = new HeartbeatMonitor(this, _stateLock);
        _transport = transport;

        _connectTask = Negotiate(transport);
    }

    return _connectTask;
}

2 - Negotiate method will increase value of TransportConnectTimeout every time the connection is started. I believe this should be set to the value returned from the server.

TransportConnectTimeout = TransportConnectTimeout + TimeSpan.FromSeconds(negotiationResponse.TransportConnectTimeout);

should be:

TransportConnectTimeout = TimeSpan.FromSeconds(negotiationResponse.TransportConnectTimeout);

Thanks.

David Fowler
Owner

The first one was has already been fixed:
https://github.com/SignalR/SignalR/blob/release/src/Microsoft.AspNet.SignalR.Client/Connection.cs#L409

The second one is a bug. Thanks for the great report.

If you want to fix the latter bug you can follow the steps here https://github.com/SignalR/SignalR/blob/master/CONTRIBUTING.md

Abhishek Nanda abnanda1 was assigned
David Fowler
Owner

@abnanda1 take a look at this one. Should be trivial to fix.

Gustavo Armenta

test automation provides coverage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.