Skip to content

Commit

Permalink
Socket.ConnectAsync() does not call SocketAsyncEventArgs.Completed wh…
Browse files Browse the repository at this point in the history
…en operation completed synchronously.

shadowsocks#1273
  • Loading branch information
celeron533 committed Aug 6, 2017
1 parent f0b196c commit 0251130
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion shadowsocks-csharp/Util/Sockets/WrappedSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ public void BeginConnect(EndPoint remoteEP, AsyncCallback callback, object state
arg.Completed += OnTcpConnectCompleted;
arg.UserToken = new TcpUserToken(callback, state);

Socket.ConnectAsync(SocketType.Stream, ProtocolType.Tcp, arg);
if(!Socket.ConnectAsync(SocketType.Stream, ProtocolType.Tcp, arg))
{
OnTcpConnectCompleted(this, arg);
}
}

private class FakeAsyncResult : IAsyncResult
Expand Down

0 comments on commit 0251130

Please sign in to comment.