Beispiel #1
0
        /// <summary>
        /// Class constructor
        /// </summary>
        public BondWorkerClient(
            LoggingContext loggingContext,
            string workerName,
            string ipAddress,
            int port,
            DistributionServices services,
            EventHandler onActivateConnection,
            EventHandler onDeactivateConnection,
            EventHandler onConnectionTimeOut)
        {
            m_loggingContext = loggingContext;
            m_workerName     = workerName;

            m_proxyManager = new BondProxyConnectionManager <WorkerProxyAdapter>(
                client: new BondTcpClient <WorkerProxyAdapter>(
                    new BondHostLog(loggingContext, ipAddress, port),
                    new BondConnectOptions(true, (uint)EngineEnvironmentSettings.DistributionConnectTimeout.Value.TotalMilliseconds)),
                loggingContext: loggingContext,
                services: services,
                createProxyCallback: client => new WorkerProxyAdapter(
                    ResiliencyTestBondTransportClient.TryWrapClientForTest(DistributedBuildRoles.Master, client)));

            m_proxyManager.OnActivateConnection   += onActivateConnection;
            m_proxyManager.OnDeactivateConnection += onDeactivateConnection;
            m_proxyManager.OnConnectionTimeOut    += onConnectionTimeOut;

            m_proxyManager.Start(ipAddress, port, this);
        }
            public TrackedConnection(BondProxyConnectionManager <TProxy> connectionManager)
            {
                m_connectionManager = connectionManager;

                // Mutex to ensure only one call is modifying connection at a time
                m_connectionSemaphore = new SemaphoreSlim(1);
            }
Beispiel #3
0
 public void Dispose()
 {
     lock (m_proxyManagerLock)
     {
         m_proxyManager?.Dispose();
         m_proxyManager = null;
     }
 }
Beispiel #4
0
        /// <nodoc/>
        public void Start(DistributionServices services, EventHandler onConnectionTimeOut)
        {
            m_proxyManager = new BondProxyConnectionManager <MasterProxyAdapter>(
                client: m_bondTcpClient,
                loggingContext: m_loggingContext,
                services: services,
                createProxyCallback: client => new BondMasterClient.MasterProxyAdapter(
                    ResiliencyTestBondTransportClient.TryWrapClientForTest(DistributedBuildRoles.Worker, client)));

            m_proxyManager.OnConnectionTimeOut += onConnectionTimeOut;

            m_proxyManager.Start(m_ipAddress, m_port, this);
        }