void OnFlow(Flow flow) { lock (this.ThisLock) { this.outgoingWindow = (uint)((flow.NextIncomingId + flow.IncomingWindow) - this.nextOutgoingId); if (this.outgoingWindow > 0) { Delivery delivery = (Delivery)this.outgoingList.First; while (delivery != null) { if (delivery.Buffer != null && delivery.Buffer.Length > 0) { break; } delivery = (Delivery)delivery.Next; } if (delivery != null) { this.WriteDelivery(delivery); } } if (this.outgoingWindow == 0) { return; } } if (flow.HasHandle) { this.GetLink(flow.Handle).OnFlow(flow); } }
internal override void OnFlow(Flow flow) { int delta = 0; if (!role) { lock (this.ThisLock) { var theirLimit = (SequenceNumber)(flow.DeliveryCount + flow.LinkCredit); var myLimit = this.deliveryCount + (SequenceNumber)this.credit; delta = theirLimit - myLimit; if (delta <= 0) { // peer reduced credit this.credit = 0; } else { this.credit = (uint)delta; } } } if (this.linkEndpoint != null) { this.linkEndpoint.OnFlow(new FlowContext(this, delta, flow.Properties)); } else if (delta != 0 && this.onCredit != null) { this.onCredit(delta, this.state); } }
internal override void OnFlow(Flow flow) { Delivery delivery = null; lock (this.ThisLock) { this.credit = (flow.DeliveryCount + flow.LinkCredit) - this.deliveryCount; if (this.writing || this.credit <= 0 || this.outgoingList.First == null) { return; } delivery = (Delivery)this.outgoingList.First; this.outgoingList.Remove(delivery); delivery.Tag = Delivery.GetDeliveryTag(this.deliveryCount); this.credit--; this.deliveryCount++; this.writing = true; } this.WriteDelivery(delivery); }
internal void SendFlow(Flow flow) { lock (this.ThisLock) { this.incomingWindow = defaultWindowSize; flow.NextOutgoingId = this.nextOutgoingId; flow.OutgoingWindow = this.outgoingWindow; flow.NextIncomingId = this.nextIncomingId; flow.IncomingWindow = this.incomingWindow; this.SendCommand(flow); } }
internal override void OnFlow(Flow flow) { var theirLimit = (SequenceNumber)(flow.DeliveryCount + flow.LinkCredit); var myLimit = (SequenceNumber)((uint)this.deliveryCount + this.credit); int delta = theirLimit - myLimit; if (this.linkEndpoint != null) { this.linkEndpoint.OnFlow(new FlowContext(this, delta, flow.Properties)); } else if (delta > 0 && this.onCredit != null) { this.onCredit(delta, this.state); } }
internal void SendFlow(uint deliveryCount, uint credit, bool drain) { Flow flow = new Flow() { Handle = this.handle, DeliveryCount = deliveryCount, LinkCredit = credit, Drain = drain }; this.session.SendFlow(flow); }
internal abstract void OnFlow(Flow flow);
internal override void OnFlow(Flow flow) { }
internal void SendFlow(uint deliveryCount, uint credit, bool drain) { lock (this.ThisLock) { if (!this.IsDetaching) { Flow flow = new Flow() { Handle = this.handle, DeliveryCount = deliveryCount, LinkCredit = credit, Drain = drain }; this.session.SendFlow(flow); } } }