Skip to content

Commit

Permalink
IGNITE-7399 .NET: Thin client: Fix NPE in Dispose
Browse files Browse the repository at this point in the history
  • Loading branch information
ptupitsyn committed Jan 15, 2018
1 parent 31c60bd commit 66cf82d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,21 @@ public void TestIdleTimeout()
}
}

/// <summary>
/// Tests the protocol mismatch behavior: attempt to connect to an HTTP endpoint.
/// </summary>
[Test]
public void TestProtocolMismatch()
{
using (Ignition.Start(TestUtils.GetTestConfiguration()))
{
// Connect to Ignite REST endpoint.
var cfg = new IgniteClientConfiguration {Host = "127.0.0.1", Port = 11211 };
var ex = Assert.Throws<SocketException>(() => Ignition.StartClient(cfg));
Assert.AreEqual(SocketError.ConnectionAborted, ex.SocketErrorCode);
}
}

/// <summary>
/// Starts the client.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,11 @@ public void Dispose()
_socket.Dispose();
_listenerEvent.Set();
_listenerEvent.Dispose();
_timeoutCheckTimer.Dispose();

if (_timeoutCheckTimer != null)
{
_timeoutCheckTimer.Dispose();
}

// Wait for lock to be released and dispose.
if (!_sendRequestLock.IsWriteLockHeld)
Expand Down

0 comments on commit 66cf82d

Please sign in to comment.