private void EndAuthenticateAsClient(IAsyncResult ar) { SslConnection lOwner = (SslConnection)ar.AsyncState; try { lOwner.fSslStream.EndAuthenticateAsClient(ar); } catch (Exception ex) { this.fFailure = ex; this.fComplete = true; lock (this) { if (this.fWaitHandle != null) { this.fWaitHandle.Set(); } } this.fCallback(ar); return; } this.fComplete = true; lock (this) { if (this.fWaitHandle != null) { this.fWaitHandle.Set(); } } this.fCallback(ar); }
public void ConnectionConnect(IAsyncResult ar) { SslConnection lOwner = (SslConnection)ar.AsyncState; try { lOwner.fInnerConnection.EndConnect(ar); } catch (Exception ex) { this.fFailure = ex; this.fComplete = true; lock (this) { if (this.fWaitHandle != null) { this.fWaitHandle.Set(); } } this.fCallback(ar); return; } lOwner.CreateSslClientStream(); lOwner.fSslStream.BeginAuthenticateAsClient(lOwner.fFactory.TargetHostName, EndAuthenticateAsClient, lOwner); }
public void ConnectionConnect(IAsyncResult ar) { SslConnection lOwner = (SslConnection)ar.AsyncState; try { lOwner.fInnerConnection.EndConnect(ar); } catch (Exception ex) { this.fFailure = ex; this.fComplete = true; lock (this) { if (this.fWaitHandle != null) { this.fWaitHandle.Set(); } } this.fCallback(ar); return; } if (lOwner.fFactory.GetMonoAssembly() != null) { lOwner.CreateMonoClientStream(); fComplete = true; lock (this) { if (this.fWaitHandle != null) { this.fWaitHandle.Set(); } } this.fCallback(ar); return; } lOwner.fSsl = new SslStream(lOwner.fInnerConnection, true, new RemoteCertificateValidationCallback(lOwner.Ssl_RemoteCertificateValidation)); ((SslStream)lOwner.fSsl).BeginAuthenticateAsClient(lOwner.fFactory.TargetHostName, new AsyncCallback(SslAuthenticateAsClient), lOwner); }