Skip to content

Commit

Permalink
Close socket if connection already timed out.
Browse files Browse the repository at this point in the history
  • Loading branch information
xinchen10 committed Sep 18, 2020
1 parent 7d3177c commit ebb75bc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Microsoft.Azure.Amqp/Amqp/Transport/TcpTransportInitiator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ static void OnConnectComplete(object sender, SocketAsyncEventArgs e)
{
thisPtr.Complete(e, false);
}
else
{
e.ConnectSocket?.Dispose();
}
}

static void OnTimer(object obj)
Expand All @@ -83,9 +87,9 @@ void Complete(SocketAsyncEventArgs e, bool completeSynchronously)
if (e.SocketError != SocketError.Success)
{
exception = new SocketException((int)e.SocketError);
if (e.AcceptSocket != null)
if (e.ConnectSocket != null)
{
e.AcceptSocket.Dispose();
e.ConnectSocket.Dispose();
}
}
else
Expand Down

0 comments on commit ebb75bc

Please sign in to comment.