/// <summary> /// Class constructor /// </summary> /// <param name="client">the bond tcp client used to create the proxy</param> /// <param name="createProxyCallback">callback used to create a bond proxy</param> /// <param name="loggingContext">the logging context</param> /// <param name="services">shared services for distribution</param> /// <param name="maxConnectionConcurrency">the maximum number of connections</param> public BondProxyConnectionManager( BondTcpClient <TProxy> client, BondTcpClient <TProxy> .CreateProxyCallback createProxyCallback, LoggingContext loggingContext, DistributionServices services, int maxConnectionConcurrency = 1) { m_client = client; m_createProxyCallback = createProxyCallback; m_loggingContext = loggingContext; m_maxConnectionConcurrency = maxConnectionConcurrency; m_services = services; m_bufferManager = services.BufferManager; m_proxySemaphore = new NullSemaphore(); // m_proxySemaphore = new SemaphoreSlim(m_maxConnectionConcurrency); m_stopwatch = Stopwatch.StartNew(); m_heartbeatTimer = new Timer(HeartbeatTimerCallback); m_connections = new TrackedConnection[m_maxConnectionConcurrency]; for (int i = 0; i < m_maxConnectionConcurrency; i++) { m_connections[i] = new TrackedConnection(this); } m_isActiveCompletionSource = TaskSourceSlim.Create <bool>(); }
/// <summary> /// Class constructor /// </summary> public BondMasterClient(LoggingContext loggingContext, string ipAddress, int port) { m_loggingContext = loggingContext; m_port = port; m_ipAddress = ipAddress; m_bondTcpClient = new BondTcpClient <BondMasterClient.MasterProxyAdapter>( new BondHostLog(loggingContext, ipAddress, port), new BondConnectOptions(true, (uint)EngineEnvironmentSettings.DistributionConnectTimeout.Value.TotalMilliseconds)); }