private void ExecuteBeginConnectDelegate(bool connectFailed) { this.m_bundleInfo = null; if (this.m_beginConnectDelegate != null) { bool isEncrypted = false; bool isSigned = false; if (this.m_sslStream != null) { isEncrypted = this.m_sslStream.IsEncrypted; isSigned = this.m_sslStream.IsSigned; } this.m_beginConnectDelegate(connectFailed, isEncrypted, isSigned); this.m_beginConnectDelegate = null; object[] args = new object[] { !connectFailed, isEncrypted, isSigned }; s_log.LogDebug("Connected={0} isEncrypted={1} isSigned={2}", args); } }
public void BeginConnect(string address, int port, SslCertBundleInfo bundleInfo, BeginConnectDelegate connectDelegate) { try { string str; string str2; try { UriUtils.GetHostAddress(address, out str); } catch (Exception exception) { s_log.LogError("Exception within GetHostAddress: " + exception.Message); return; } this.m_address = address; if (UriUtils.GetHostAddressAsIp(address, out str2)) { this.m_address = "::ffff:" + address; } this.m_resolvedAddress = "::ffff:" + str; object[] args = new object[] { str, port }; s_log.LogDebug("Connecting to {0}:{1}", args); IPEndPoint remoteEP = new IPEndPoint(IPAddress.Parse(str), port); this.m_beginConnectDelegate = connectDelegate; this.m_bundleInfo = bundleInfo; this.m_socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); this.m_socket.BeginConnect(remoteEP, new AsyncCallback(this.ConnectCallback), address); } catch (Exception exception2) { object[] objArray2 = new object[] { exception2 }; s_log.LogWarning("Exception while trying to call BeginConnect. {0}", objArray2); this.ExecuteBeginConnectDelegate(true); } }