public async Task PassiveWorkerAsync() { while (this._n < this._ctx.LoopCount) { MsgOut m = await this._subPassive.NextMessageAsync(CancellationToken.None); bool match = this._ctx.DeserializeAndCheckSimpleJson(m.GetPayloadAsByteArray(), this._n); Debug.Assert(match); ++_n; } }
private void ReactiveListener(MsgOut message, CancellationToken token) { bool match = this._ctx.DeserializeAndCheckSimpleJson(message.GetPayloadAsByteArray(), this._n); Debug.Assert(match); ++_n; if (this._n >= this._ctx.LoopCount) { this._cde.Signal(); } }
public void PassiveWorker(object state) { while (this._n < this._ctx.LoopCount) { MsgOut m = this._subPassive.NextMessage(CancellationToken.None); bool match = this._ctx.DeserializeAndCheckSimpleJson(m.GetPayloadAsByteArray(), this._n); Debug.Assert(match); ++_n; } this._cde.Signal(); }
void IReqRepImpl.SlaveEndPointWorker(SlaveClientContext ctx) { var conn = (IConnection)ctx.Connection; var sub = (IPassiveSubscription)ctx.Subscription; while (ctx.IsComplete == false) { MsgOut m = sub.NextMessage(CancellationToken.None); ISlaveEndPoint ep = ctx.EndPoints[m.Subject]; var segment = ep.GetResponse(m.GetPayloadAsByteArray()); ctx.AddBytes(m.PayloadLength + segment.Count); conn.Publish( new MsgIn(m.ReplyTo).SetPayload(segment), CancellationToken.None ); } }
void IReqRepImpl.MasterEndPointWorker(object state) { var ep = (IMasterEndPoint)state; var conn = (IConnection)ep.MasterClient.Connection; int n = ep.MasterClient.LoopCount; while (--n >= 0) { if (n == 0) { ep.Release(); } var segment = ep.GetRequest(); MsgOut m = conn.Request( new MsgIn(ep.TargetSubject).SetPayload(segment), RequestTimeout, CancellationToken.None ); ep.ValidateResponse(m.GetPayloadAsByteArray()); } }