public AnimateLeds(IOutputSegment segment) { _segment = segment; _leds = Enumerable.Range(0, _segment.Length).ToArray(); _ledsRev = _leds.Reverse().ToArray(); LitTime = _litTimeDefault; DimTime = _dimTimeDefault; }
// called after the last message has been queued. // could be if !shouldKeepAlive on request - last message will have been queued // could be if user indicates connection close - could have pending messages, all should be cancelled public void OnCompleted() { var c = new LastConsumer(tail); if (tail == null) { // implicitly end socket c.AttachSocket(socket); } else { var t = tail; tail = c; t.AttachNextSegment(c); } }
public virtual void Dispose() { if (socket != null) { var s = socket; socket = null; s.End(); } if (previous != null) { var p = previous; previous = null; p.Dispose(); } }
public virtual void Dispose() { if (socket != null) { var s = socket; socket = null; s.End(); } if (previous != null) { var p = previous; previous = null; p.Dispose(); } }
// each one of these represents an entire response message (continue, headers, body) public void OnNext(IDataProducer message) { var c = new MessageConsumer(tail, message); var t = tail; tail = c; if (t == null) { c.AttachSocket(socket); } else { t.AttachNextSegment(c); } }
public override void AttachNextSegment(IOutputSegment c) { next = c; DoConnect(); HandOffSocketIfPossible(); }
public MessageConsumer(IOutputSegment previous, IDataProducer message) : base(previous) { this.message = message; }
public override void AttachNextSegment(IOutputSegment c) { throw new NotSupportedException(); }
public LastConsumer(IOutputSegment previous) : base(previous) { }
public abstract void AttachNextSegment(IOutputSegment next);
public BaseConsumer(IOutputSegment previous) { this.previous = previous; }
public void Dispose() { _segment?.Dispose(); _segment = null !; }
public MessageConsumer(IOutputSegment previous, IDataProducer message) : base(previous) { this.message = message; }
public override void AttachNextSegment(IOutputSegment c) { throw new NotSupportedException(); }
public LastConsumer(IOutputSegment previous) : base(previous) { }
public abstract void AttachNextSegment(IOutputSegment next);
public virtual void AttachSocket(ISocket socket) { previous = null; this.socket = socket; }
public virtual void AttachSocket(ISocket socket) { previous = null; this.socket = socket; }
public BaseConsumer(IOutputSegment previous) { this.previous = previous; }
public override void AttachNextSegment(IOutputSegment c) { next = c; DoConnect(); HandOffSocketIfPossible(); }