public SipInviteServerDialog(
             ISipTransaction transaction, 
             SipDialogTable dialogTable,
             ITimerFactory timerFactory,
             SipHeaderFactory headerFactory,
             SipMessageFactory messageFactory,
             SipAddressFactory addressFactory,
             ISipMessageSender messageSender,
             ISipListener listener,
            IPEndPoint listeningPoint)
            : base(headerFactory, messageFactory, addressFactory, messageSender, listener, listeningPoint, transaction)
        {
            Check.Require(transaction, "transaction");
            Check.Require(dialogTable, "dialogTable");
            Check.Require(timerFactory, "timerFactory");

            _logger = NLog.LogManager.GetCurrentClassLogger();

            _dialogTable = dialogTable;
            _state = DialogState.Null;
            _timerFactory = timerFactory;

            //(only ?) localtag is set on firstresponse
            //localtarget is not defined, because is has no use, (every user agent knows it local address)

            _retransmitOkTimer = _timerFactory.CreateInviteCtxRetransmitTimer(OnOkReTransmit);
            //_endWaitForAckTimer = _timerFactory.CreateInviteCtxTimeOutTimer(OnWaitForAckTimeOut);

            if (_logger.IsInfoEnabled) _logger.Info("ServerDialog[Id={0}] created.", GetId());
        }
Example #2
0
        public void ExpectStxToDisposeThemselfWhenTheirEndTimerHasFired()
        {
            var s = new Mock<ISipMessageSender>();
            var l = new Mock<ISipListener>();
            var txTable = new SipServerTransactionTable();
            var tfsBuilder = new TimerFactoryStubBuilder();
            tfsBuilder.WithNonInviteStxEndCompletedTimerInterceptor((a) => new TxTimerStub(a, 1000, false, AfterCallBack));
            tfs = tfsBuilder.Build();
            for (int i = 0; i < Number; i++)
            {
                var r = new SipRequestBuilder().WithCSeq(new SipCSeqHeaderBuilder().WithSequence(i).Build()).Build();
                var stx = new SipNonInviteServerTransaction(txTable, r, l.Object, s.Object, tfs);

                /*go to completed state */
                stx.SendResponse(new SipResponseBuilder()
                    .WithStatusLine(new SipStatusLineBuilder()
                    .WithStatusCode(200)
                    .WithReason("OK")
                    .Build())
                    .Build());
            }

            /*wait for Number of timers to fire*/
            are.WaitOne();

            Assert.IsTrue(!txTable.AsEnumerable().Any());
        }
Example #3
0
 public RssPlugin(IBitTorrentEngine torrentEngine, IDataRepository dataRepository, ITimerFactory timerFactory, IWebClient webClient)
 {
     _torrentEngine = torrentEngine;
     _dataRepository = dataRepository;
     _timer = timerFactory.CreateTimer();
     _webClient = webClient;
 }
Example #4
0
		public MainViewModel()
		{
			serviceFactory = ViewModelController.ServiceFactory<ICustomerService>();
			timerFactory = ViewModelController.TimerFactory();

			MessageBroker.Register<DeleteCustomerMessage>(this, DeleteCustomer);

			Property(() => FullName).OnChanged(x => NameLength = x.Length);

			InitializeProperties();
		}
Example #5
0
        public RssPlugin(ILogger<RssPlugin> logger, ITimerFactory timerFactory, IRssRepository rssRepository, IFeedChecker feedChecker)
        {
            if (logger == null) throw new ArgumentNullException("logger");
            if (timerFactory == null) throw new ArgumentNullException("timerFactory");
            if (rssRepository == null) throw new ArgumentNullException("rssRepository");
            if (feedChecker == null) throw new ArgumentNullException("feedChecker");

            _logger = logger;
            _rssRepository = rssRepository;
            _timer = timerFactory.Create(60000, CheckFeeds);
            _feedChecker = feedChecker;
        }
Example #6
0
 public AutoAddPlugin(IKeyValueStore keyValueStore,
     IDataRepository dataRepository,
     IBitTorrentEngine bitTorrentEngine,
     IFileSystem fileSystem,
     ITimerFactory timerFactory)
 {
     _keyValueStore = keyValueStore;
     _dataRepository = dataRepository;
     _bitTorrentEngine = bitTorrentEngine;
     _fileSystem = fileSystem;
     _timerFactory = timerFactory;
 }
        internal SipNonInviteServerTransaction(
            SipServerTransactionTable table, 
            SipRequest request, 
            ISipListener listener, 
            ISipMessageSender messageSender,
            ITimerFactory timerFactory)
            : base(table, request, listener, messageSender, timerFactory)
        {
            Check.IsTrue(request.RequestLine.Method != SipMethods.Invite, "Request method can not be 'INVITE'.");
            Check.IsTrue(request.RequestLine.Method != SipMethods.Ack, "Request method can not be 'ACK'.");

            EndCompletedTimer = _timerFactory.CreateNonInviteStxEndCompletedTimer(OnCompletedEnded);
        }
Example #8
0
        public ThreadRunner(Func<bool> executionCondition, ThreadResult result, TimingSettings settings, BenchmarkState sharedState, Action test, ITimerFactory timerFactory)
        {
            this.ExecutionCondition = executionCondition;
            this.Result = result;
            this.Settings = settings;
            this.SharedState = sharedState;
            this.Test = test;

            Timer = timerFactory.Create();

            thread = new Thread(Run);
            thread.IsBackground = true;
        }
 public ProductionProviderMonitor(
     MetlConfiguration _metlServerAddress,
     ITimerFactory _timerFactory,
     IReceiveEvents _receiveEvents,
     IWebClient _webCleint,
     IAuditor _auditor
     )
 {
     auditor = _auditor;
     metlServerAddress = _metlServerAddress;
     timerFactory = _timerFactory;
     client = _webCleint;
 }
        protected SipAbstractServerTransaction(SipServerTransactionTable table, SipRequest request, ISipListener listener, ISipMessageSender messageSender, ITimerFactory timerFactory)
        {
            Check.Require(table, "table");
            Check.Require(request, "request");
            Check.Require(listener, "listener");
            Check.Require(messageSender, "messageSender");
            Check.Require(timerFactory, "timerFactory");

            _table = table;
            _request = request;
            _listener = listener;
            _messageSender = messageSender;
            _timerFactory = timerFactory;
        }
        public FileManager(string hostDirectory, IFileSystem fileSystem, ITimerFactory timerFactory)
        {
            _FileSystem = fileSystem;
            _HostDirectory = hostDirectory;
            _TimerFactory = timerFactory;

            LoadFiles();

            return;
            var watcher = new FileSystemWatcher(hostDirectory, _FileFilter);

            watcher.NotifyFilter = NotifyFilters.CreationTime | NotifyFilters.FileName | NotifyFilters.LastWrite | NotifyFilters.Size;
            watcher.Changed += watcher_Changed;
            watcher.EnableRaisingEvents = true;
        }
Example #12
0
        public AutoAddPlugin(ILogger<AutoAddPlugin> logger,
            ITimerFactory timerFactory,
            IAutoAddRepository repository,
            IFolderScanner folderScanner)
        {
            if (logger == null) throw new ArgumentNullException("logger");
            if (timerFactory == null) throw new ArgumentNullException("timerFactory");
            if (repository == null) throw new ArgumentNullException("repository");
            if (folderScanner == null) throw new ArgumentNullException("folderScanner");

            _logger = logger;
            _repository = repository;
            _folderScanner = folderScanner;
            _timer = timerFactory.Create(5000, CheckFolders);
        }
        internal SipNonInviteClientTransaction(
            SipClientTransactionTable table,
            ISipMessageSender messageSender,
            ISipListener listener,
            SipRequest request,
            ITimerFactory timerFactory)
            : base(table, request, messageSender, listener, timerFactory)
        {
            Check.IsTrue(request.RequestLine.Method != SipMethods.Invite, "Method 'INVITE' is not allowed");
            Check.IsTrue(request.RequestLine.Method != SipMethods.Ack, "Method 'ACK' is not allowed");

            _logger = NLog.LogManager.GetCurrentClassLogger();

            ReTransmitTimer = _timerFactory.CreateNonInviteCtxRetransmitTimer(OnReTransmit);
            TimeOutTimer = _timerFactory.CreateNonInviteCtxTimeOutTimer(OnTimeOut);
            EndCompletedTimer = _timerFactory.CreateNonInviteCtxEndCompletedTimer(OnCompletedEnded);
        }
        internal SipInviteServerTransaction(
            SipServerTransactionTable table,
            ISipMessageSender messageSender,
            ISipListener listener,
            SipRequest request,
            ITimerFactory timerFactory)
            : base(table, request, listener, messageSender, timerFactory)
        {
            Check.IsTrue(request.RequestLine.Method == SipMethods.Invite, "Method other then 'INVITE' is not allowed");

            _logger = NLog.LogManager.GetCurrentClassLogger();

            ReTransmitNonx200FinalResponseTimer = _timerFactory.CreateInviteStxRetransmitTimer(OnReTransmitNonx200FinalResponse);
            EndCompletedTimer = _timerFactory.CreateInviteStxEndCompletedTimer(OnCompletedEnded);
            EndConfirmedTimer = _timerFactory.CreateInviteStxEndConfirmed(OnConfirmedEnded);
            SendTryingTimer = _timerFactory.CreateInviteStxSendTryingTimer(OnSendTryingTimer);
        }
Example #15
0
        internal SoftPhone(ISipProvider provider, SipMessageFactory messageFactory, SipHeaderFactory headerFactory,
            SipAddressFactory addressFactory, ISoftPhoneStateProvider stateProvider, ITimerFactory timerFactory, SipListeningPoint listeningPoint)
        {
            ListeningPoint = listeningPoint;
            _provider = provider;
            _messageFactory = messageFactory;
            _headerFactory = headerFactory;
            _addressFactory = addressFactory;
            _stateProvider = stateProvider;
            _timerFactory = timerFactory;

            InternalState = _stateProvider.GetIdle();
            InternalState.Initialize(this);
            RetransmitRingingTimer = _timerFactory.CreateRingingTimer(OnRetransmitRinging);
            EndWaitForAckTimer = _timerFactory.CreateInviteCtxTimeOutTimer(OnWaitForAckTimeOut);

            if(_logger.IsDebugEnabled) _logger.Debug("Initialized.");
        }
Example #16
0
        /// <summary>
        /// Internal constructor for Chronometer. Initializes a new instance of Chronometer with the given options.
        /// </summary>
        /// <param name="options"><see cref="ChronometerOptions"/></param>
        /// <param name="normalizedMeanCalculator">Implementation of <see cref="INormalizedMeanCalculator"/></param>
        /// <param name="timerFactory">Implementation of <see cref="ITimerFactory"/></param>
        /// <param name="memoryOptimizer">Implementation of <see cref="IMemoryOptimizer"/></param>
        /// <param name="performanceOptimizer">Implementation of <see cref="IPerformanceOptimizer"/></param>
        /// <param name="debugModeDetector">Implementation of <see cref="IDebugModeDetector"/></param>
        internal Chronometer(
            ChronometerOptions options, 
            INormalizedMeanCalculator normalizedMeanCalculator,
            ITimerFactory timerFactory,
            IMemoryOptimizer memoryOptimizer,
            IPerformanceOptimizer performanceOptimizer,
            IDebugModeDetector debugModeDetector)
        {
            if(options == null)
                throw new ArgumentNullException("options");

            if(options.NumberOfInterations == null)
                throw new ArgumentException(Properties.Resources.NumberOfIterationsLessThan1ExceptionMessage, "options");

            if(options.NumberOfInterations.HasValue && options.NumberOfInterations.Value < 1)
                throw new ArgumentException(Properties.Resources.NumberOfIterationsLessThan1ExceptionMessage, "options");

            if(normalizedMeanCalculator == null)
                throw new ArgumentNullException("normalizedMeanCalculator");

            if(timerFactory == null)
                throw new ArgumentNullException("timerFactory");

            if (memoryOptimizer == null)
                throw new ArgumentNullException("memoryOptimizer");

            if (performanceOptimizer == null)
                throw new ArgumentNullException("performanceOptimizer");

            if (debugModeDetector == null)
                throw new ArgumentNullException("debugModeDetector");

            Options = options;
            _normalizedMeanCalculator = normalizedMeanCalculator;
            _timerFactory = timerFactory;
            _memoryOptimizer = memoryOptimizer;
            _performanceOptimizer = performanceOptimizer;
            _debugModeDetector = debugModeDetector;
        }
        internal SipInviteClientTransaction(
            SipClientTransactionTable table,
            ISipMessageSender messageSender,
            ISipListener listener, 
            SipRequest request, 
            ITimerFactory timerFactory, 
            SipHeaderFactory headerFactory,
            SipMessageFactory messageFactory)
            : base(table, request, messageSender, listener, timerFactory)
        {
            Check.Require(headerFactory, "headerFactory");
            Check.Require(messageFactory, "messageFactory");

            Check.IsTrue(request.RequestLine.Method == SipMethods.Invite, "Method other then 'INVITE' is not allowed");

            _logger = NLog.LogManager.GetCurrentClassLogger();

            _headerFactory = headerFactory;
            _messageFactory = messageFactory;

            ReTransmitTimer = timerFactory.CreateInviteCtxRetransmitTimer(OnReTransmit);
            TimeOutTimer = timerFactory.CreateInviteCtxTimeOutTimer(OnTimeOut);
            EndCompletedTimer = timerFactory.CreateInviteCtxEndCompletedTimer(OnCompletedEnded);
        }
Example #18
0
 public BenchmarkState(ITimerFactory timerFactory)
 {
     TimerFromBeginning = timerFactory.Create();
 }
Example #19
0
        /// <summary>
        /// Creates a new instance. This class is also used to shareable a context across all instance that are created below one Cluster instance.
        /// One configuration instance per Cluster instance.
        /// </summary>
        internal Configuration(Policies policies,
                               ProtocolOptions protocolOptions,
                               PoolingOptions poolingOptions,
                               SocketOptions socketOptions,
                               ClientOptions clientOptions,
                               IAuthProvider authProvider,
                               IAuthInfoProvider authInfoProvider,
                               QueryOptions queryOptions,
                               IAddressTranslator addressTranslator,
                               IStartupOptionsFactory startupOptionsFactory,
                               ISessionFactoryBuilder <IInternalCluster, IInternalSession> sessionFactoryBuilder,
                               IReadOnlyDictionary <string, IExecutionProfile> executionProfiles,
                               IRequestOptionsMapper requestOptionsMapper,
                               MetadataSyncOptions metadataSyncOptions,
                               IEndPointResolver endPointResolver,
                               IDriverMetricsProvider driverMetricsProvider,
                               DriverMetricsOptions metricsOptions,
                               string sessionName,
                               IRequestHandlerFactory requestHandlerFactory         = null,
                               IHostConnectionPoolFactory hostConnectionPoolFactory = null,
                               IRequestExecutionFactory requestExecutionFactory     = null,
                               IConnectionFactory connectionFactory = null,
                               IControlConnectionFactory controlConnectionFactory = null,
                               IPrepareHandlerFactory prepareHandlerFactory       = null,
                               ITimerFactory timerFactory = null,
                               IObserverFactoryBuilder observerFactoryBuilder = null)
        {
            AddressTranslator     = addressTranslator ?? throw new ArgumentNullException(nameof(addressTranslator));
            QueryOptions          = queryOptions ?? throw new ArgumentNullException(nameof(queryOptions));
            Policies              = policies;
            ProtocolOptions       = protocolOptions;
            PoolingOptions        = poolingOptions;
            SocketOptions         = socketOptions;
            ClientOptions         = clientOptions;
            AuthProvider          = authProvider;
            AuthInfoProvider      = authInfoProvider;
            StartupOptionsFactory = startupOptionsFactory;
            SessionFactoryBuilder = sessionFactoryBuilder;
            RequestOptionsMapper  = requestOptionsMapper;
            MetadataSyncOptions   = metadataSyncOptions?.Clone() ?? new MetadataSyncOptions();
            DnsResolver           = new DnsResolver();
            EndPointResolver      = endPointResolver ?? new EndPointResolver(DnsResolver, protocolOptions);
            MetricsOptions        = metricsOptions ?? new DriverMetricsOptions();
            MetricsProvider       = driverMetricsProvider ?? new NullDriverMetricsProvider();
            SessionName           = sessionName;
            MetricsEnabled        = driverMetricsProvider != null;

            ObserverFactoryBuilder    = observerFactoryBuilder ?? (MetricsEnabled ? (IObserverFactoryBuilder) new MetricsObserverFactoryBuilder() : new NullObserverFactoryBuilder());
            RequestHandlerFactory     = requestHandlerFactory ?? new RequestHandlerFactory();
            HostConnectionPoolFactory = hostConnectionPoolFactory ?? new HostConnectionPoolFactory();
            RequestExecutionFactory   = requestExecutionFactory ?? new RequestExecutionFactory();
            ConnectionFactory         = connectionFactory ?? new ConnectionFactory();
            ControlConnectionFactory  = controlConnectionFactory ?? new ControlConnectionFactory();
            PrepareHandlerFactory     = prepareHandlerFactory ?? new PrepareHandlerFactory();
            TimerFactory = timerFactory ?? new TaskBasedTimerFactory();

            RequestOptions    = RequestOptionsMapper.BuildRequestOptionsDictionary(executionProfiles, policies, socketOptions, clientOptions, queryOptions);
            ExecutionProfiles = BuildExecutionProfilesDictionary(executionProfiles, RequestOptions);

            // Create the buffer pool with 16KB for small buffers and 256Kb for large buffers.
            // The pool does not eagerly reserve the buffers, so it doesn't take unnecessary memory
            // to create the instance.
            BufferPool = new RecyclableMemoryStreamManager(16 * 1024, 256 * 1024, ProtocolOptions.MaximumFrameLength);
            Timer      = new HashedWheelTimer();
        }
Example #20
0
 public DlnaEntryPoint(IServerConfigurationManager config,
                       ILogManager logManager,
                       IServerApplicationHost appHost,
                       ISessionManager sessionManager,
                       IHttpClient httpClient,
                       ILibraryManager libraryManager,
                       IUserManager userManager,
                       IDlnaManager dlnaManager,
                       IImageProcessor imageProcessor,
                       IUserDataManager userDataManager,
                       ILocalizationManager localization,
                       IMediaSourceManager mediaSourceManager,
                       IDeviceDiscovery deviceDiscovery, IMediaEncoder mediaEncoder, ISocketFactory socketFactory, ITimerFactory timerFactory, IEnvironmentInfo environmentInfo, INetworkManager networkManager)
 {
     _config             = config;
     _appHost            = appHost;
     _sessionManager     = sessionManager;
     _httpClient         = httpClient;
     _libraryManager     = libraryManager;
     _userManager        = userManager;
     _dlnaManager        = dlnaManager;
     _imageProcessor     = imageProcessor;
     _userDataManager    = userDataManager;
     _localization       = localization;
     _mediaSourceManager = mediaSourceManager;
     _deviceDiscovery    = deviceDiscovery;
     _mediaEncoder       = mediaEncoder;
     _socketFactory      = socketFactory;
     _timerFactory       = timerFactory;
     _environmentInfo    = environmentInfo;
     _networkManager     = networkManager;
     _logger             = logManager.GetLogger("Dlna");
 }
Example #21
0
        public DeviceDiscovery(ILogger logger, IServerConfigurationManager config, ISocketFactory socketFactory, ITimerFactory timerFactory)
        {
            _tokenSource = new CancellationTokenSource();

            _logger        = logger;
            _config        = config;
            _socketFactory = socketFactory;
            _timerFactory  = timerFactory;
        }
Example #22
0
 public Notifications(IInstallationManager installationManager, IUserManager userManager, ILogger logger, ITaskManager taskManager, INotificationManager notificationManager, ILibraryManager libraryManager, ISessionManager sessionManager, IServerApplicationHost appHost, IConfigurationManager config, IDeviceManager deviceManager, ITimerFactory timerFactory)
 {
     _installationManager = installationManager;
     _userManager         = userManager;
     _logger              = logger;
     _taskManager         = taskManager;
     _notificationManager = notificationManager;
     _libraryManager      = libraryManager;
     _sessionManager      = sessionManager;
     _appHost             = appHost;
     _config              = config;
     _deviceManager       = deviceManager;
     _timerFactory        = timerFactory;
 }
Example #23
0
 public ActivityLogWebSocketListener(ILogger logger, ITimerFactory timerFactory, IActivityManager activityManager) : base(logger, timerFactory)
 {
     _activityManager = activityManager;
     _activityManager.EntryCreated += _activityManager_EntryCreated;
 }
        public QualityProfileProviderCachingDecorator(IQualityProfileProvider wrappedProvider, BoundSonarQubeProject boundProject,
                                                      ISonarQubeService sonarQubeService, ITimerFactory timerFactory)
        {
            if (wrappedProvider == null)
            {
                throw new ArgumentNullException(nameof(wrappedProvider));
            }

            if (boundProject == null)
            {
                throw new ArgumentNullException(nameof(boundProject));
            }

            if (sonarQubeService == null)
            {
                throw new ArgumentNullException(nameof(sonarQubeService));
            }

            if (timerFactory == null)
            {
                throw new ArgumentNullException(nameof(timerFactory));
            }

            this.wrappedProvider  = wrappedProvider;
            this.boundProject     = boundProject;
            this.sonarQubeService = sonarQubeService;

            this.refreshTimer           = timerFactory.Create();
            this.refreshTimer.AutoReset = true;
            this.refreshTimer.Interval  = MillisecondsToWaitBetweenRefresh;
            this.refreshTimer.Elapsed  += OnRefreshTimerElapsed;

            initialFetchCancellationTokenSource = new CancellationTokenSource();
            this.initialFetch = Task.Factory.StartNew(DoInitialFetch, initialFetchCancellationTokenSource.Token);
            refreshTimer.Start();
        }
Example #25
0
 public ReadScheduler(ITimerFactory timerFactory, IReadingsRepository readingsRepository)
 {
     _timerFactory       = timerFactory;
     _readingsRepository = readingsRepository;
 }
Example #26
0
 public Device(DeviceInfo deviceProperties, IHttpClient httpClient, ILogger logger, IServerConfigurationManager config, ITimerFactory timerFactory)
 {
     Properties    = deviceProperties;
     _httpClient   = httpClient;
     _logger       = logger;
     _config       = config;
     _timerFactory = timerFactory;
 }
Example #27
0
        public static async Task <Device> CreateuPnpDeviceAsync(Uri url, IHttpClient httpClient, IServerConfigurationManager config, ILogger logger, ITimerFactory timerFactory, CancellationToken cancellationToken)
        {
            var ssdpHttpClient = new SsdpHttpClient(httpClient, config);

            var document = await ssdpHttpClient.GetDataAsync(url.ToString(), cancellationToken).ConfigureAwait(false);

            var deviceProperties = new DeviceInfo();

            var friendlyNames = new List <string>();

            var name = document.Descendants(uPnpNamespaces.ud.GetName("friendlyName")).FirstOrDefault();

            if (name != null && !string.IsNullOrWhiteSpace(name.Value))
            {
                friendlyNames.Add(name.Value);
            }

            var room = document.Descendants(uPnpNamespaces.ud.GetName("roomName")).FirstOrDefault();

            if (room != null && !string.IsNullOrWhiteSpace(room.Value))
            {
                friendlyNames.Add(room.Value);
            }

            deviceProperties.Name = string.Join(" ", friendlyNames.ToArray(friendlyNames.Count));

            var model = document.Descendants(uPnpNamespaces.ud.GetName("modelName")).FirstOrDefault();

            if (model != null)
            {
                deviceProperties.ModelName = model.Value;
            }

            var modelNumber = document.Descendants(uPnpNamespaces.ud.GetName("modelNumber")).FirstOrDefault();

            if (modelNumber != null)
            {
                deviceProperties.ModelNumber = modelNumber.Value;
            }

            var uuid = document.Descendants(uPnpNamespaces.ud.GetName("UDN")).FirstOrDefault();

            if (uuid != null)
            {
                deviceProperties.UUID = uuid.Value;
            }

            var manufacturer = document.Descendants(uPnpNamespaces.ud.GetName("manufacturer")).FirstOrDefault();

            if (manufacturer != null)
            {
                deviceProperties.Manufacturer = manufacturer.Value;
            }

            var manufacturerUrl = document.Descendants(uPnpNamespaces.ud.GetName("manufacturerURL")).FirstOrDefault();

            if (manufacturerUrl != null)
            {
                deviceProperties.ManufacturerUrl = manufacturerUrl.Value;
            }

            var presentationUrl = document.Descendants(uPnpNamespaces.ud.GetName("presentationURL")).FirstOrDefault();

            if (presentationUrl != null)
            {
                deviceProperties.PresentationUrl = presentationUrl.Value;
            }

            var modelUrl = document.Descendants(uPnpNamespaces.ud.GetName("modelURL")).FirstOrDefault();

            if (modelUrl != null)
            {
                deviceProperties.ModelUrl = modelUrl.Value;
            }

            var serialNumber = document.Descendants(uPnpNamespaces.ud.GetName("serialNumber")).FirstOrDefault();

            if (serialNumber != null)
            {
                deviceProperties.SerialNumber = serialNumber.Value;
            }

            var modelDescription = document.Descendants(uPnpNamespaces.ud.GetName("modelDescription")).FirstOrDefault();

            if (modelDescription != null)
            {
                deviceProperties.ModelDescription = modelDescription.Value;
            }

            deviceProperties.BaseUrl = String.Format("http://{0}:{1}", url.Host, url.Port);

            var icon = document.Descendants(uPnpNamespaces.ud.GetName("icon")).FirstOrDefault();

            if (icon != null)
            {
                deviceProperties.Icon = CreateIcon(icon);
            }

            foreach (var services in document.Descendants(uPnpNamespaces.ud.GetName("serviceList")))
            {
                if (services == null)
                {
                    continue;
                }

                var servicesList = services.Descendants(uPnpNamespaces.ud.GetName("service"));

                if (servicesList == null)
                {
                    continue;
                }

                foreach (var element in servicesList)
                {
                    var service = Create(element);

                    if (service != null)
                    {
                        deviceProperties.Services.Add(service);
                    }
                }
            }

            var device = new Device(deviceProperties, httpClient, logger, config, timerFactory);

            if (device.GetAvTransportService() != null)
            {
                await device.GetRenderingProtocolAsync(cancellationToken).ConfigureAwait(false);

                await device.GetAVProtocolAsync(cancellationToken).ConfigureAwait(false);
            }

            return(device);
        }
Example #28
0
        public DlnaEntryPoint(IServerConfigurationManager config,
                              ILoggerFactory loggerFactory,
                              IServerApplicationHost appHost,
                              ISessionManager sessionManager,
                              IHttpClient httpClient,
                              ILibraryManager libraryManager,
                              IUserManager userManager,
                              IDlnaManager dlnaManager,
                              IImageProcessor imageProcessor,
                              IUserDataManager userDataManager,
                              ILocalizationManager localizationManager,
                              IMediaSourceManager mediaSourceManager,
                              IDeviceDiscovery deviceDiscovery,
                              IMediaEncoder mediaEncoder,
                              ISocketFactory socketFactory,
                              ITimerFactory timerFactory,
                              IEnvironmentInfo environmentInfo,
                              INetworkManager networkManager,
                              IUserViewManager userViewManager,
                              IXmlReaderSettingsFactory xmlReaderSettingsFactory,
                              ITVSeriesManager tvSeriesManager)
        {
            _config             = config;
            _appHost            = appHost;
            _sessionManager     = sessionManager;
            _httpClient         = httpClient;
            _libraryManager     = libraryManager;
            _userManager        = userManager;
            _dlnaManager        = dlnaManager;
            _imageProcessor     = imageProcessor;
            _userDataManager    = userDataManager;
            _localization       = localizationManager;
            _mediaSourceManager = mediaSourceManager;
            _deviceDiscovery    = deviceDiscovery;
            _mediaEncoder       = mediaEncoder;
            _socketFactory      = socketFactory;
            _timerFactory       = timerFactory;
            _environmentInfo    = environmentInfo;
            _networkManager     = networkManager;
            _logger             = loggerFactory.CreateLogger("Dlna");

            ContentDirectory = new ContentDirectory.ContentDirectory(dlnaManager,
                                                                     userDataManager,
                                                                     imageProcessor,
                                                                     libraryManager,
                                                                     config,
                                                                     userManager,
                                                                     _logger,
                                                                     httpClient,
                                                                     localizationManager,
                                                                     mediaSourceManager,
                                                                     userViewManager,
                                                                     mediaEncoder,
                                                                     xmlReaderSettingsFactory,
                                                                     tvSeriesManager);

            ConnectionManager = new ConnectionManager.ConnectionManager(dlnaManager, config, _logger, httpClient, xmlReaderSettingsFactory);

            MediaReceiverRegistrar = new MediaReceiverRegistrar.MediaReceiverRegistrar(_logger, httpClient, config, xmlReaderSettingsFactory);
            Current = this;
        }
Example #29
0
 public MemoryReclaimer(ITimerFactory timerFactory)
 {
     _timerFactory = timerFactory;
 }
Example #30
0
 public MediaSourceManager(IItemRepository itemRepo, IApplicationPaths applicationPaths, ILocalizationManager localizationManager, IUserManager userManager, ILibraryManager libraryManager, ILogger logger, IJsonSerializer jsonSerializer, IFileSystem fileSystem, IUserDataManager userDataManager, ITimerFactory timerFactory, Func <IMediaEncoder> mediaEncoder)
 {
     _itemRepo            = itemRepo;
     _userManager         = userManager;
     _libraryManager      = libraryManager;
     _logger              = logger;
     _jsonSerializer      = jsonSerializer;
     _fileSystem          = fileSystem;
     _userDataManager     = userDataManager;
     _timerFactory        = timerFactory;
     _mediaEncoder        = mediaEncoder;
     _localizationManager = localizationManager;
     _appPaths            = applicationPaths;
 }
        /// <summary>
        /// Creates a new instance. This class is also used to shareable a context across all instance that are created below one Cluster instance.
        /// One configuration instance per Cluster instance.
        /// </summary>
        internal Configuration(Policies policies,
                               ProtocolOptions protocolOptions,
                               PoolingOptions poolingOptions,
                               SocketOptions socketOptions,
                               ClientOptions clientOptions,
                               IAuthProvider authProvider,
                               IAuthInfoProvider authInfoProvider,
                               QueryOptions queryOptions,
                               IAddressTranslator addressTranslator,
                               IReadOnlyDictionary <string, IExecutionProfile> executionProfiles,
                               MetadataSyncOptions metadataSyncOptions,
                               IEndPointResolver endPointResolver,
                               IDriverMetricsProvider driverMetricsProvider,
                               DriverMetricsOptions metricsOptions,
                               string sessionName,
                               GraphOptions graphOptions,
                               Guid?clusterId,
                               string appVersion,
                               string appName,
                               MonitorReportingOptions monitorReportingOptions,
                               TypeSerializerDefinitions typeSerializerDefinitions,
                               bool?keepContactPointsUnresolved,
                               ISessionFactory sessionFactory                       = null,
                               IRequestOptionsMapper requestOptionsMapper           = null,
                               IStartupOptionsFactory startupOptionsFactory         = null,
                               IInsightsSupportVerifier insightsSupportVerifier     = null,
                               IRequestHandlerFactory requestHandlerFactory         = null,
                               IHostConnectionPoolFactory hostConnectionPoolFactory = null,
                               IRequestExecutionFactory requestExecutionFactory     = null,
                               IConnectionFactory connectionFactory                 = null,
                               IControlConnectionFactory controlConnectionFactory   = null,
                               IPrepareHandlerFactory prepareHandlerFactory         = null,
                               ITimerFactory timerFactory = null,
                               IObserverFactoryBuilder observerFactoryBuilder = null,
                               IInsightsClientFactory insightsClientFactory   = null,
                               IContactPointParser contactPointParser         = null,
                               IServerNameResolver serverNameResolver         = null,
                               IDnsResolver dnsResolver = null)
        {
            AddressTranslator = addressTranslator ?? throw new ArgumentNullException(nameof(addressTranslator));
            QueryOptions      = queryOptions ?? throw new ArgumentNullException(nameof(queryOptions));
            GraphOptions      = graphOptions ?? new GraphOptions();

            ClusterId                   = clusterId ?? Guid.NewGuid();
            ApplicationVersion          = appVersion ?? Configuration.DefaultApplicationVersion;
            ApplicationName             = appName ?? Configuration.FallbackApplicationName;
            ApplicationNameWasGenerated = appName == null;

            Policies                    = policies;
            ProtocolOptions             = protocolOptions;
            PoolingOptions              = poolingOptions;
            SocketOptions               = socketOptions;
            ClientOptions               = clientOptions;
            AuthProvider                = authProvider;
            AuthInfoProvider            = authInfoProvider;
            StartupOptionsFactory       = startupOptionsFactory ?? new StartupOptionsFactory(ClusterId, ApplicationVersion, ApplicationName);
            SessionFactory              = sessionFactory ?? new SessionFactory();
            RequestOptionsMapper        = requestOptionsMapper ?? new RequestOptionsMapper();
            MetadataSyncOptions         = metadataSyncOptions?.Clone() ?? new MetadataSyncOptions();
            DnsResolver                 = dnsResolver ?? new DnsResolver();
            MetricsOptions              = metricsOptions ?? new DriverMetricsOptions();
            MetricsProvider             = driverMetricsProvider ?? new NullDriverMetricsProvider();
            SessionName                 = sessionName;
            MetricsEnabled              = driverMetricsProvider != null;
            TypeSerializers             = typeSerializerDefinitions?.Definitions;
            KeepContactPointsUnresolved = keepContactPointsUnresolved ?? false;

            ObserverFactoryBuilder    = observerFactoryBuilder ?? (MetricsEnabled ? (IObserverFactoryBuilder) new MetricsObserverFactoryBuilder() : new NullObserverFactoryBuilder());
            RequestHandlerFactory     = requestHandlerFactory ?? new RequestHandlerFactory();
            HostConnectionPoolFactory = hostConnectionPoolFactory ?? new HostConnectionPoolFactory();
            RequestExecutionFactory   = requestExecutionFactory ?? new RequestExecutionFactory();
            ConnectionFactory         = connectionFactory ?? new ConnectionFactory();
            ControlConnectionFactory  = controlConnectionFactory ?? new ControlConnectionFactory();
            PrepareHandlerFactory     = prepareHandlerFactory ?? new PrepareHandlerFactory();
            TimerFactory = timerFactory ?? new TaskBasedTimerFactory();

            RequestOptions    = RequestOptionsMapper.BuildRequestOptionsDictionary(executionProfiles, policies, socketOptions, clientOptions, queryOptions, GraphOptions);
            ExecutionProfiles = BuildExecutionProfilesDictionary(executionProfiles, RequestOptions);

            MonitorReportingOptions = monitorReportingOptions ?? new MonitorReportingOptions();
            InsightsSupportVerifier = insightsSupportVerifier ?? Configuration.DefaultInsightsSupportVerifier;
            InsightsClientFactory   = insightsClientFactory ?? Configuration.DefaultInsightsClientFactory;
            ServerNameResolver      = serverNameResolver ?? new ServerNameResolver(ProtocolOptions);
            EndPointResolver        = endPointResolver ?? new EndPointResolver(ServerNameResolver);
            ContactPointParser      = contactPointParser ?? new ContactPointParser(DnsResolver, ProtocolOptions, ServerNameResolver, KeepContactPointsUnresolved);

            // Create the buffer pool with 16KB for small buffers and 256Kb for large buffers.
            // The pool does not eagerly reserve the buffers, so it doesn't take unnecessary memory
            // to create the instance.
            BufferPool = new RecyclableMemoryStreamManager(16 * 1024, 256 * 1024, ProtocolOptions.MaximumFrameLength);
            Timer      = new HashedWheelTimer();
        }
Example #32
0
 public ITimerFactory GetTimerFactory()
 {
     return _txTimerFactory ?? (_txTimerFactory = new TimerFactory());
 }
Example #33
0
 public UserDataChangeNotifier(IUserDataManager userDataManager, ISessionManager sessionManager, ILogger logger, IUserManager userManager, ITimerFactory timerFactory)
 {
     _userDataManager = userDataManager;
     _sessionManager  = sessionManager;
     _logger          = logger;
     _userManager     = userManager;
     _timerFactory    = timerFactory;
 }
Example #34
0
		public static void Set(ITimerFactory instance)
		{
			singletonInstance.Set(() => instance);
		}
Example #35
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LibraryMonitor" /> class.
        /// </summary>
        public LibraryMonitor(ILoggerFactory loggerFactory, ITaskManager taskManager, ILibraryManager libraryManager, IServerConfigurationManager configurationManager, IFileSystem fileSystem, ITimerFactory timerFactory, ISystemEvents systemEvents, IEnvironmentInfo environmentInfo)
        {
            if (taskManager == null)
            {
                throw new ArgumentNullException(nameof(taskManager));
            }

            LibraryManager       = libraryManager;
            TaskManager          = taskManager;
            Logger               = loggerFactory.CreateLogger(GetType().Name);
            ConfigurationManager = configurationManager;
            _fileSystem          = fileSystem;
            _timerFactory        = timerFactory;
            _environmentInfo     = environmentInfo;

            systemEvents.Resume += _systemEvents_Resume;
        }
Example #36
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ApiEntryPoint" /> class.
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="sessionManager">The session manager.</param>
        /// <param name="config">The configuration.</param>
        /// <param name="fileSystem">The file system.</param>
        /// <param name="mediaSourceManager">The media source manager.</param>
        public ApiEntryPoint(ILogger logger, ISessionManager sessionManager, IServerConfigurationManager config, IFileSystem fileSystem, IMediaSourceManager mediaSourceManager, ITimerFactory timerFactory, IProcessFactory processFactory, IHttpResultFactory resultFactory)
        {
            Logger              = logger;
            _sessionManager     = sessionManager;
            _config             = config;
            _fileSystem         = fileSystem;
            _mediaSourceManager = mediaSourceManager;
            TimerFactory        = timerFactory;
            ProcessFactory      = processFactory;
            ResultFactory       = resultFactory;

            Instance = this;
            _sessionManager.PlaybackProgress += _sessionManager_PlaybackProgress;
            _sessionManager.PlaybackStart    += _sessionManager_PlaybackStart;
        }
Example #37
0
 public TimerManager(IFileSystem fileSystem, IJsonSerializer jsonSerializer, ILogger logger, string dataPath, ILogger logger1, ITimerFactory timerFactory)
     : base(fileSystem, jsonSerializer, logger, dataPath, (r1, r2) => string.Equals(r1.Id, r2.Id, StringComparison.OrdinalIgnoreCase))
 {
     _logger       = logger1;
     _timerFactory = timerFactory;
 }
Example #38
0
        public FileRefresher(string path, IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, ITaskManager taskManager, ILogger logger, ITimerFactory timerFactory, IEnvironmentInfo environmentInfo, ILibraryManager libraryManager1)
        {
            logger.Debug("New file refresher created for {0}", path);
            Path = path;

            _fileSystem          = fileSystem;
            ConfigurationManager = configurationManager;
            LibraryManager       = libraryManager;
            TaskManager          = taskManager;
            Logger           = logger;
            _timerFactory    = timerFactory;
            _environmentInfo = environmentInfo;
            _libraryManager  = libraryManager1;
            AddPath(path);
        }
Example #39
0
 public LibraryChangedNotifier(ILibraryManager libraryManager, ISessionManager sessionManager, IUserManager userManager, ILogger logger, ITimerFactory timerFactory)
 {
     _libraryManager = libraryManager;
     _sessionManager = sessionManager;
     _userManager    = userManager;
     _logger         = logger;
     _timerFactory   = timerFactory;
 }
Example #40
0
 public IntervalTimer(ITimerFactory factory)
 {
     this.factory = factory;
     timers = new Dictionary<TimerClient, System.Timers.Timer>();
 }
Example #41
0
 public TranscodingJob(ILogger logger, ITimerFactory timerFactory)
 {
     Logger        = logger;
     _timerFactory = timerFactory;
 }
Example #42
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        protected SsdpDeviceLocatorBase(ISsdpCommunicationsServer communicationsServer, ITimerFactory timerFactory)
        {
            if (communicationsServer == null)
            {
                throw new ArgumentNullException("communicationsServer");
            }

            _CommunicationsServer = communicationsServer;
            _timerFactory         = timerFactory;
            _CommunicationsServer.ResponseReceived += CommsServer_ResponseReceived;

            _SearchResultsSynchroniser = new object();
            _Devices = new List <DiscoveredSsdpDevice>();
        }
Example #43
0
 public ConnectEntryPoint(IHttpClient httpClient, IApplicationPaths appPaths, ILogger logger, INetworkManager networkManager, IConnectManager connectManager, IApplicationHost appHost, IFileSystem fileSystem, ITimerFactory timerFactory)
 {
     _httpClient     = httpClient;
     _appPaths       = appPaths;
     _logger         = logger;
     _networkManager = networkManager;
     _connectManager = connectManager;
     _appHost        = appHost;
     _fileSystem     = fileSystem;
     _timerFactory   = timerFactory;
 }
Example #44
0
 public MediaSourceManager(IItemRepository itemRepo, IUserManager userManager, ILibraryManager libraryManager, ILogger logger, IJsonSerializer jsonSerializer, IFileSystem fileSystem, IUserDataManager userDataManager, ITimerFactory timerFactory)
 {
     _itemRepo        = itemRepo;
     _userManager     = userManager;
     _libraryManager  = libraryManager;
     _logger          = logger;
     _jsonSerializer  = jsonSerializer;
     _fileSystem      = fileSystem;
     _userDataManager = userDataManager;
     _timerFactory    = timerFactory;
 }
Example #45
0
        public GrangerFeature(
            [NotNull] ILogger logger,
            [NotNull] IWurmAssistantDataDirectory dataDirectory,
            [NotNull] ISoundManager soundManager,
            [NotNull] ITrayPopups trayPopups,
            [NotNull] IWurmApi wurmApi,
            [NotNull] GrangerSettings grangerSettings,
            [NotNull] DefaultBreedingEvaluatorOptions defaultBreedingEvaluatorOptions,
            [NotNull] IWurmAssistantConfig wurmAssistantConfig,
            [NotNull] ITimerFactory timerFactory,
            [NotNull] CreatureColorDefinitions creatureColorDefinitions,
            [NotNull] GrangerContext grangerContext,
            [NotNull] IFormEditCreatureColorsFactory formEditCreatureColorsFactory)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            if (dataDirectory == null)
            {
                throw new ArgumentNullException(nameof(dataDirectory));
            }
            if (soundManager == null)
            {
                throw new ArgumentNullException(nameof(soundManager));
            }
            if (trayPopups == null)
            {
                throw new ArgumentNullException(nameof(trayPopups));
            }
            if (wurmApi == null)
            {
                throw new ArgumentNullException(nameof(wurmApi));
            }
            if (grangerSettings == null)
            {
                throw new ArgumentNullException(nameof(grangerSettings));
            }
            if (defaultBreedingEvaluatorOptions == null)
            {
                throw new ArgumentNullException(nameof(defaultBreedingEvaluatorOptions));
            }
            if (wurmAssistantConfig == null)
            {
                throw new ArgumentNullException(nameof(wurmAssistantConfig));
            }
            if (timerFactory == null)
            {
                throw new ArgumentNullException(nameof(timerFactory));
            }
            if (creatureColorDefinitions == null)
            {
                throw new ArgumentNullException(nameof(creatureColorDefinitions));
            }
            if (grangerContext == null)
            {
                throw new ArgumentNullException(nameof(grangerContext));
            }
            if (formEditCreatureColorsFactory == null)
            {
                throw new ArgumentNullException(nameof(formEditCreatureColorsFactory));
            }

            this.logger        = logger;
            this.dataDirectory = dataDirectory;
            this.soundManager  = soundManager;
            this.trayPopups    = trayPopups;

            settings = grangerSettings;
            this.defaultBreedingEvaluatorOptions = defaultBreedingEvaluatorOptions;
            this.creatureColorDefinitions        = creatureColorDefinitions;

            context = grangerContext;
            this.formEditCreatureColorsFactory = formEditCreatureColorsFactory;

            grangerUi = new FormGrangerMain(this,
                                            settings,
                                            context,
                                            logger,
                                            wurmApi,
                                            defaultBreedingEvaluatorOptions,
                                            creatureColorDefinitions,
                                            formEditCreatureColorsFactory);

            logsFeedMan = new LogsFeedManager(this, context, wurmApi, logger, trayPopups, wurmAssistantConfig, creatureColorDefinitions, grangerSettings);
            logsFeedMan.UpdatePlayers(settings.CaptureForPlayers);
            grangerUi.GrangerPlayerListChanged += GrangerUI_Granger_PlayerListChanged;

            updateLoop          = timerFactory.CreateUiThreadTimer();
            updateLoop.Interval = TimeSpan.FromMilliseconds(500);
            updateLoop.Tick    += (sender, args) => Update();
            updateLoop.Start();
        }
Example #46
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="jsonSerializer"></param>
        /// <param name="sessionManager"> </param>
        /// <param name="userDataManager"></param>
        /// <param name="libraryManager"> </param>
        /// <param name="logger"></param>
        /// <param name="httpClient"></param>
        /// <param name="appHost"></param>
        /// <param name="fileSystem"></param>
        public ServerMediator(IJsonSerializer jsonSerializer, ISessionManager sessionManager, IUserDataManager userDataManager, ILibraryManager libraryManager, ILogManager logger, IHttpClient httpClient, IServerApplicationHost appHost, IFileSystem fileSystem, ITimerFactory timerFactory)
        {
            Instance         = this;
            _sessionManager  = sessionManager;
            _libraryManager  = libraryManager;
            _userDataManager = userDataManager;
            _logger          = logger.GetLogger("Trakt");

            _traktApi = new TraktApi(jsonSerializer, _logger, httpClient, appHost, userDataManager, fileSystem);
            _service  = new TraktUriService(_traktApi, _logger, _libraryManager);
            _libraryManagerEventsHelper  = new LibraryManagerEventsHelper(_logger, _traktApi, timerFactory);
            _userDataManagerEventsHelper = new UserDataManagerEventsHelper(_logger, _traktApi, timerFactory);
        }
 private SplunkAppender Create(ITaskRunner taskRunner = null,
                                 ISplunkWriterFactory factory = null,
                                 ILogBufferItemRepositoryFactory bufferItemRepositoryFactory = null,
                                 ITimerFactory timerFactory = null)
 {
     // ReSharper disable once UseObjectOrCollectionInitializer
     var splunkAppender = new SplunkAppender(taskRunner ?? CreateImmediateTaskRunner(),
         factory ?? Substitute.For<ISplunkWriterFactory>(),
         bufferItemRepositoryFactory ?? Substitute.For<ILogBufferItemRepositoryFactory>(),
         timerFactory ?? Substitute.For<ITimerFactory>());
     splunkAppender.Name = RandomValueGen.GetRandomString(10, 20);
     return splunkAppender;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SystemInfoWebSocketListener" /> class.
 /// </summary>
 public SystemInfoWebSocketListener(ILogger logger, IServerApplicationHost appHost, ITimerFactory timerFactory)
     : base(logger, timerFactory)
 {
     _appHost = appHost;
 }
Example #49
0
        public SchedulerEntry(WeakReference <EntityActionScheduler <T> > scheduler, T entity, long period, ITimerFactory timerFactory)
        {
            _scheduler = scheduler;
            _entity    = entity;
            _period    = period;

            // Don't capture the current ExecutionContext and its AsyncLocals onto the timer causing them to live forever
            var restoreFlow = false;

            try
            {
                if (!ExecutionContext.IsFlowSuppressed())
                {
                    ExecutionContext.SuppressFlow();
                    restoreFlow = true;
                }

                _timer = timerFactory.CreateTimer(static s => _ = TimerCallback(s), this, Timeout.Infinite, Timeout.Infinite);
Example #50
0
 public TestableCachingDecorator(IQualityProfileProvider wrappedProvider, BoundSonarQubeProject boundProject,
                                 ISonarQubeService sonarQubeService, ITimerFactory timerFactory)
     : base(wrappedProvider, boundProject, sonarQubeService, timerFactory)
 {
 }
Example #51
0
 public void SetTimerFactory(ITimerFactory timerFactory)
 {
     _txTimerFactory = timerFactory;
 }
Example #52
0
 public NewsEntryPoint(IHttpClient httpClient, IApplicationPaths appPaths, IFileSystem fileSystem, ILogger logger, IJsonSerializer json, INotificationManager notifications, IUserManager userManager, ITimerFactory timerFactory)
 {
     _httpClient    = httpClient;
     _appPaths      = appPaths;
     _fileSystem    = fileSystem;
     _logger        = logger;
     _json          = json;
     _notifications = notifications;
     _userManager   = userManager;
     _timerFactory  = timerFactory;
 }
Example #53
0
        protected virtual void EnsureCorrectSettings()
        {
            if(Settings == null)
                throw new ArgumentNullException("Settings not set");

            if(TimerFactory == null)
                TimerFactory = new StopwatchTimerFactory();

            Settings.EnsureCorrectSettings();
        }
 public ExternalPortForwarding(ILoggerFactory loggerFactory, IServerApplicationHost appHost, IServerConfigurationManager config, IDeviceDiscovery deviceDiscovery, IHttpClient httpClient, ITimerFactory timerFactory)
 {
     _logger                       = loggerFactory.CreateLogger("PortMapper");
     _appHost                      = appHost;
     _config                       = config;
     _deviceDiscovery              = deviceDiscovery;
     _httpClient                   = httpClient;
     _timerFactory                 = timerFactory;
     _config.ConfigurationUpdated += _config_ConfigurationUpdated1;
 }