Esempio n. 1
0
    public PingModule(IProvider <IPAddress> addressProvider)
    {
        _cancelTokenSource = new CancellationTokenSource();

        _requestProducer = new PingRequestProducerWorkStage(1, addressProvider, NextRequestFor, _cancelTokenSource.Token);
        _pinger          = new PingWorkStage(4, 10 * 2, _cancelTokenSource.Token);
        _replyProcessor  = new PingReplyProcessingWorkStage(2, 10 * 2, _cancelTokenSource.Token);
        // connect the pipeline.
        _requestProducer.ConnectTo(_pinger);
        _pinger.ConnectTo(_replyProcessor);
        _replyProcessor.ConnectTo(this);
    }
    // ...
    public PingModule(IProvider <IPAddress> addressProvider)
    {
        _cancelTokenSource = new CancellationTokenSource();

        _requestProducer     = new PingRequestProducerWorkStage(1, addressProvider, NextRequestFor, _cancelTokenSource.Token);
        _disconnectedPinger  = new PingWorkStage(2, 10 * 2, _cancelTokenSource.Token);
        _slowAddressesPinger = new PingWorkStage(2, 10 * 2, _cancelTokenSource.Token);
        _normalPinger        = new PingWorkStage(3, 10 * 2, _cancelTokenSource.Token);
        _requestRouter       = new RequestRouter(RoutePingRequest);
        _replyProcessor      = new PingReplyProcessingWorkStage(2, 10 * 2, _cancelTokenSource.Token);
        // connect the pipeline
        _requestProducer.ConnectTo(_requestRouter);
        _disconnectedPinger.ConnectTo(_replyProcessor);
        _slowAddressesPinger.ConnectTo(_replyProcessor);
        _normalPinger.ConnectTo(_replyProcessor);
        _replyProcessor.ConnectTo(this);
    }