private void BeginSend() { IWriteRequest req = CurrentWriteRequest; if (req == null) { req = WriteRequestQueue.Poll(this); if (req == null) { Interlocked.Exchange(ref _writing, 0); return; } } IoBuffer buf = req.Message as IoBuffer; if (buf == null) { throw new InvalidOperationException("Don't know how to handle message of type '" + req.Message.GetType().Name + "'. Are you missing a protocol encoder?"); } else { CurrentWriteRequest = req; if (buf.HasRemaining) { BeginSend(buf); } else { EndSend(0); } } }
/// <inheritdoc/> public ICloseFuture CloseOnFlush() { if (!Closing) { WriteRequestQueue.Offer(this, CLOSE_REQUEST); Processor.Flush(this); } return(_closeFuture); }
private ICloseFuture CloseOnFlush() { WriteRequestQueue.Offer(this, CLOSE_REQUEST); Processor.Flush(this); return(_closeFuture); }