private static void InitializeConnectionCallback(IAsyncResult result)
{
if (!result.CompletedSynchronously)
{
ConnectAndHandshakeAsyncResult thisPtr = (ConnectAndHandshakeAsyncResult)result.AsyncState;
thisPtr._connection.EndInitializeConnection(result);
if (NetEventSource.IsEnabled) NetEventSource.Info(null, $"Connect returned {thisPtr}");
try
{
thisPtr.Handshake();
}
catch (Exception e)
{
thisPtr.InvokeCallback(e);
}
}
}