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); }
public override void Start(string message, StationDesc src) { pinger = src; var grabPinger = Station.Grab(pinger); grabPinger.Signaled += handlePing; grabPinger.Blocked += handleBlock; }
private void _accept(string message, StationDesc src) { if (--_count < 1) { _station.Linked -= _accept; _station.Linked += _block; } Accepted(_station, message, src); }
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(); }
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(); }
public Task Prepare(StationDesc destination, string message = "") => _station.Send(MsgType.Link, message).To(destination);
public Runner(StationDesc next) : base(1) { Next = next; _tcs = new TaskCompletionSource <string>(); }
private void handleBlock(string msg, StationDesc src) { Station.Close(); }
private void handlePing(string msg, StationDesc src) { Station.Log($"{msg} from {src.Name}"); pong(); }
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(); }
private void _block(string message, StationDesc src) { _station.Send(MsgType.Block).To(src); }
protected abstract void Accepted(IStation station, string message, StationDesc src);