Пример #1
0
 public SequentialInputSource(GetInputStream resourceFactory, ITelemetryCryptoProvider cryptoProvider)
 {
     _resourceFactory  = resourceFactory;
     _cryptoProvider   = cryptoProvider;
     readerThread      = new Thread(ThreadBody);
     readerThread.Name = "SequentialInputSource";
     readerThread.Start();
 }
 public SequentialOutputSink(GetOutputStream resourceFactory, ITelemetryCryptoProvider cryptoProvider)
 {
     _resourceFactory      = resourceFactory;
     _cryptoProvider       = cryptoProvider;
     writerThread          = new Thread(ThreadBody);
     writerThread.Name     = "SequentialOutputSink";
     writerThread.Priority = ThreadPriority.Highest;
     writerThread.Start();
 }
        public MultiplexOutputSink(GetOutputStream streamFactory, ITelemetryCryptoProvider cryptoProvider)
        {
            _streamFactory  = streamFactory;
            _cryptoProvider = cryptoProvider;
            processor       = new QueuedMultiThreadProcessorWithDispatchCapabilities <byte[]>(
                // worker thread count
                250,

                ThreadPriority.Highest,
                Write,
                // worker thread dispatch slots count
                dispatchLimit: Environment.ProcessorCount * 2,
                threadDescription: "MultiplexOutputSink_Write");
        }
Пример #4
0
        public MultiplexInputSource(GetInputStream endpointConnection, ITelemetryCryptoProvider cryptoProvider)
        {
            _endpointConnection = endpointConnection;
            _cryptoProvider     = cryptoProvider;

            packageProcessor = new QueuedMultiThreadProcessorWithDispatchCapabilities <byte[]>(
                Environment.ProcessorCount,
                250,
                ThreadPriority.Highest,
                (package) => OnPackageReceived?.Invoke(package),
                dispatchLimit: Environment.ProcessorCount * 2,
                threadDescription: "MultiplexInputSource_Read");

            packageReader = new MultiThreadProcessor(ThreadPriority.Highest, ReadPackages);
        }
Пример #5
0
        public TelemetryClient(IPEndPoint endPoint,
                               ProcessTelemetryRequest processTelemetryRequest,
                               ProcessTelemetryEvent processTelemetryEvent,
                               IContractSerializer contractSerializer,
                               ITelemetryCryptoProvider cryptoProvider)
        {
            _processTelemetryRequest = processTelemetryRequest;
            _processTelemetryEvent   = processTelemetryEvent;
            _contractSerializer      = contractSerializer;
            _cryptoProvider          = cryptoProvider;
            _endPoint = endPoint;

            Channel = new MultiplexTelemetryChannel(
                contractSerializer,
                processTelemetryRequest,
                processTelemetryEvent,
                new MultiplexInputSource(channelResources.GetResource, cryptoProvider),
                new MultiplexOutputSink(channelResources.GetResource, cryptoProvider));

            Connect();
        }