public static IHostConnection CreateConnection(HostConnectionType ProxyType) { try { if (!ConfigLoaded) { LoadFromConfig(); } foreach (var host in CurrentHostConnections.Values) { if (ProxyType == host.HostType) { return(host); } } return(null); } catch (Exception ex) { LOG.Error(string.Format("创建连接类型{0}失败:{1}", ProxyType.ToString(), ex)); return(null); } }
public static void ReleaseConnection(HostConnectionType ProxyType) { try { foreach (var host in CurrentHostConnections.Values) { host.StopConnect(); } } catch (Exception ex) { LOG.Error(string.Format("断开连接类型{0}失败:{1}", ProxyType.ToString(), ex)); } }