private void SendNextPartialBufferSegment()
{
Debug.Assert(_partiallySentBuffer != null);
var buffer = _partiallySentBuffer.Value;
int remaining = buffer.Count - _partiallySentBufferOffset;
int count = Math.Min(remaining, _outputBuffer.Length);
buffer.CopyTo(_partiallySentBufferOffset, _outputBuffer, 0, count);
_partiallySentBufferOffset += count;
if(_partiallySentBufferOffset == buffer.Count)
{
_partiallySentBuffer = null;
}
SendOutputBuffer(count);
}