// if the buffer is not empty, then stuff as much as possible into the LWIP buffers again
if (!RingBuffer_IsEmpty(&out.rb))
{
// get number of bytes that can be copied/accessed in ascending order
n=MIN(tcp_sndbuf(lwip_dbg.accepted), RingBuffer_GetCountLinear(&out.rb));
// copy data directly from ringbuffer memory to LWIP memory
tcp_write(lwip_dbg.accepted, RingBuffer_GetTail(&out.rb), n, TCP_WRITE_FLAG_COPY);
// free ringbuffer memory
RingBuffer_MoveTail(&out.rb, n);
}
|