Hi Zhenhua,

> These two patches are for server side partial write.
> 
> When server writes data into non-blocking IO, we first get the
> read pointer of write_buf and write data as much as we can. Then
> we advance the read_ptr according to the real bytes written.
> ---
>  gatchat/ringbuffer.c |    8 ++++++++
>  gatchat/ringbuffer.h |    7 +++++++
>  2 files changed, 15 insertions(+), 0 deletions(-)
> 
> diff --git a/gatchat/ringbuffer.c b/gatchat/ringbuffer.c
> index 42d5b68..e17c1fa 100644
> --- a/gatchat/ringbuffer.c
> +++ b/gatchat/ringbuffer.c
> @@ -130,6 +130,14 @@ int ring_buffer_read(struct ring_buffer *buf, void
>  *data, unsigned int len) return len;
>  }
> 
> +int ring_buffer_read_advance(struct ring_buffer *buf, unsigned int len)
> +{
> +     len = MIN(len, buf->in - buf->out);
> +     buf->out += len;
> +
> +     return len;
> +}
> +

ring_buffer_drain already does this, that is the one you want to use.

Regards,
-Denis
_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono

Reply via email to