static void SendStartTlsCallback(IAsyncResult result) //7 { if (!result.CompletedSynchronously) { ConnectAndHandshakeAsyncResult thisPtr = (ConnectAndHandshakeAsyncResult)result.AsyncState; try { StartTlsCommand.EndSend(result); TlsStream TlsStream = new TlsStream( thisPtr.connection.pooledStream.ServicePoint.Host, thisPtr.connection.pooledStream.NetworkStream, ServicePointManager.CheckCertificateRevocationList, (SslProtocols)ServicePointManager.SecurityProtocol, thisPtr.connection.ClientCertificates, thisPtr.connection.pooledStream.ServicePoint, thisPtr.connection.client, thisPtr.m_OuterResult.ContextCopy); thisPtr.connection.pooledStream.NetworkStream = TlsStream; thisPtr.connection.responseReader = new SmtpReplyReaderFactory(thisPtr.connection.pooledStream.NetworkStream); thisPtr.SendEHello(); } catch (Exception e) { thisPtr.InvokeCallback(e); } } }
private bool SendStartTls() { IAsyncResult result = StartTlsCommand.BeginSend(_connection, SendStartTlsCallback, this); if (result.CompletedSynchronously) { StartTlsCommand.EndSend(result); TlsStreamAuthenticate(); return(true); } return(false); }
private bool SendStartTls() { IAsyncResult result = StartTlsCommand.BeginSend(this.connection, new AsyncCallback(SmtpConnection.ConnectAndHandshakeAsyncResult.SendStartTlsCallback), this); if (result.CompletedSynchronously) { StartTlsCommand.EndSend(result); TlsStream stream = new TlsStream(this.connection.pooledStream.ServicePoint.Host, this.connection.pooledStream.NetworkStream, this.connection.ClientCertificates, this.connection.pooledStream.ServicePoint, this.connection.client, this.m_OuterResult.ContextCopy); this.connection.pooledStream.NetworkStream = stream; this.connection.responseReader = new SmtpReplyReaderFactory(this.connection.pooledStream.NetworkStream); this.SendEHello(); return(true); } return(false); }
bool SendStartTls()//6 { IAsyncResult result = StartTlsCommand.BeginSend(connection, SendStartTlsCallback, this); if (result.CompletedSynchronously) { StartTlsCommand.EndSend(result); TlsStream TlsStream = new TlsStream(connection.pooledStream.ServicePoint.Host, connection.pooledStream.NetworkStream, connection.ClientCertificates, connection.pooledStream.ServicePoint, connection.client, m_OuterResult.ContextCopy); connection.pooledStream.NetworkStream = TlsStream; connection.responseReader = new SmtpReplyReaderFactory(connection.pooledStream.NetworkStream); SendEHello(); return(true); } return(false); }
private static void SendStartTlsCallback(IAsyncResult result) { if (!result.CompletedSynchronously) { ConnectAndHandshakeAsyncResult thisPtr = (ConnectAndHandshakeAsyncResult)result.AsyncState; try { StartTlsCommand.EndSend(result); thisPtr.TlsStreamAuthenticate(); } catch (Exception e) { thisPtr.InvokeCallback(e); } } }
private static void SendStartTlsCallback(IAsyncResult result) { if (!result.CompletedSynchronously) { SmtpConnection.ConnectAndHandshakeAsyncResult asyncState = (SmtpConnection.ConnectAndHandshakeAsyncResult)result.AsyncState; try { StartTlsCommand.EndSend(result); TlsStream stream = new TlsStream(asyncState.connection.pooledStream.ServicePoint.Host, asyncState.connection.pooledStream.NetworkStream, asyncState.connection.ClientCertificates, asyncState.connection.pooledStream.ServicePoint, asyncState.connection.client, asyncState.m_OuterResult.ContextCopy); asyncState.connection.pooledStream.NetworkStream = stream; asyncState.connection.responseReader = new SmtpReplyReaderFactory(asyncState.connection.pooledStream.NetworkStream); asyncState.SendEHello(); } catch (Exception exception) { asyncState.InvokeCallback(exception); } } }