Exemple #1
0
        protected Task <string> Call(StationDesc func, string message)
        {
            var finished = _station.Grab(func).When(MsgType.Signal);

            _station.Send(MsgType.Link, message).To(func);
            return(finished);
        }
Exemple #2
0
        public override void Start(string message, StationDesc src)
        {
            pinger = src;

            var grabPinger = Station.Grab(pinger);

            grabPinger.Signaled += handlePing;
            grabPinger.Blocked  += handleBlock;
        }
Exemple #3
0
 private void _accept(string message, StationDesc src)
 {
     if (--_count < 1)
     {
         _station.Linked -= _accept;
         _station.Linked += _block;
     }
     Accepted(_station, message, src);
 }
Exemple #4
0
        private async void handlePong(string msg, StationDesc src)
        {
            station.Log($"{msg} from {src.Name}");
            if (--cnt == 0)
            {
                await station.Send(MsgType.Block, "").To(ponger);

                station.Close();
                return;
            }
            ping();
        }
Exemple #5
0
        protected sealed override async void Accepted(IStation station, string message, StationDesc src)
        {
            _station          = station;
            station.Signaled += (string msg, StationDesc _) =>
            {
                _tcs.TrySetResult(msg);
            };

            Next = src;

            var rst = await Invoked(message);

            await station.Send(MsgType.Signal, rst).To(Next);

            station.Close();
        }
Exemple #6
0
 public Task Prepare(StationDesc destination, string message = "") => _station.Send(MsgType.Link, message).To(destination);
Exemple #7
0
 public Runner(StationDesc next) : base(1)
 {
     Next = next;
     _tcs = new TaskCompletionSource <string>();
 }
Exemple #8
0
 private void handleBlock(string msg, StationDesc src)
 {
     Station.Close();
 }
Exemple #9
0
 private void handlePing(string msg, StationDesc src)
 {
     Station.Log($"{msg} from {src.Name}");
     pong();
 }
Exemple #10
0
        protected sealed override async void Accepted(IStation station, string message, StationDesc src)
        {
            _station = station;

            string rst = await Invoked(message);

            await station.Send(MsgType.Signal, rst).To(src);

            station.Close();
        }
Exemple #11
0
 private void _block(string message, StationDesc src)
 {
     _station.Send(MsgType.Block).To(src);
 }
Exemple #12
0
 protected abstract void Accepted(IStation station, string message, StationDesc src);