/*
         * Only called under this.thisLock
         */
        void StartIdleConnectionTimer(IotHubDeviceMuxConnection iotHubDeviceMuxConnection)
        {
#if WINDOWS_UWP
            var idleTimer = new IOThreadTimerSlim(this.IdleConnectionTimerCallback, iotHubDeviceMuxConnection, false);
#else
            var idleTimer = new IOThreadTimer(this.IdleConnectionTimerCallback, iotHubDeviceMuxConnection, false);
#endif
            this.idleTimers.Add(iotHubDeviceMuxConnection, idleTimer);
            idleTimer.Set(this.idleTimeout);
        }
            public CachedConnection(IotHubConnectionCache cache, IotHubConnection connection)
            {
                this.cache      = cache;
                this.Connection = connection;
                this.ThisLock   = new object();
#if WINDOWS_UWP
                this.idleTimer = new IOThreadTimerSlim(s => ((CachedConnection)s).IdleTimerCallback(), this, false);
#else
                this.idleTimer = new IOThreadTimer(s => ((CachedConnection)s).IdleTimerCallback(), this, false);
#endif

                this.idleTimer.Set(this.cache.IdleTimeout);
            }
Пример #3
0
        public IotHubConnection(IotHubConnectionString connectionString, AccessRights accessRights, AmqpTransportSettings amqpTransportSettings)
        {
            this.connectionString     = connectionString;
            this.accessRights         = accessRights;
            this.faultTolerantSession = new FaultTolerantAmqpObject <AmqpSession>(this.CreateSessionAsync, this.CloseConnection);

#if WINDOWS_UWP
            this.refreshTokenTimer = new IOThreadTimerSlim(s => ((IotHubConnection)s).OnRefreshToken(), this, false);
#else
            this.refreshTokenTimer = new IOThreadTimer(s => ((IotHubConnection)s).OnRefreshToken(), this, false);
#endif

            this.amqpTransportSettings = amqpTransportSettings;
        }
        public IotHubScopeConnectionPool(IotHubConnectionCache cache, IotHubConnectionString connectionString, AmqpTransportSettings amqpTransportSettings)
        {
            Fx.Assert(cache != null, "IotHubConnectionCache reference is null");
            this.cache            = cache;
            this.ConnectionString = connectionString;
            this.Connection       = new IotHubSingleTokenConnection(this, connectionString, amqpTransportSettings);
            this.thisLock         = new object();
#if WINDOWS_UWP || PCL || NETSTANDARD1_3
            this.idleTimer = new IOThreadTimerSlim(s => ((IotHubScopeConnectionPool)s).IdleTimerCallback(), this, false);
#else
            this.idleTimer = new IOThreadTimer(s => ((IotHubScopeConnectionPool)s).IdleTimerCallback(), this, false);
#endif
            this.idleTimeout = amqpTransportSettings.AmqpConnectionPoolSettings.ConnectionIdleTimeout;
            this.idleTimer.Set(this.idleTimeout);
        }