Пример #1
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();
        }
Пример #2
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();
        }
Пример #3
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();
        }
Пример #4
0
        public void Open(IStation station, string[] args)
        {
            this.station = station;
            if (args.Length > 0 && Int32.TryParse(args[0], out var c))
            {
                this.cnt = c;
            }

            station.Grab(ponger).Signaled += handlePong;

            station.Send(MsgType.Link, "").To(ponger);

            if (this.cnt > 0)
            {
                ping();
            }
            else
            {
                station.Close();
            }
        }