private static void HandshakeCallback(IAsyncResult result)
{
if (!result.CompletedSynchronously)
{
ConnectAndHandshakeAsyncResult thisPtr = (ConnectAndHandshakeAsyncResult)result.AsyncState;
try
{
try
{
LineInfo info = thisPtr._connection.Reader.CurrentReader.EndReadLine(result);
if (info.StatusCode != SmtpStatusCode.ServiceReady)
{
thisPtr.InvokeCallback(new SmtpException(info.StatusCode, info.Line, true));
return;
}
if (!thisPtr.SendEHello())
{
return;
}
}
catch (SmtpException)
{
if (!thisPtr.SendHello())
{
return;
}
}
}
catch (Exception e)
{
thisPtr.InvokeCallback(e);
}
}
}