Re: [PATCH 02/26] pkt-line: introduce struct packet_reader

2018-01-09 Thread Brandon Williams
On 01/09, Jonathan Tan wrote: > On Tue, 2 Jan 2018 16:18:04 -0800 > Brandon Williams wrote: > > > diff --git a/pkt-line.h b/pkt-line.h > > index 06c468927..c446e886a 100644 > > --- a/pkt-line.h > > +++ b/pkt-line.h > > @@ -111,6 +111,63 @@ char *packet_read_line_buf(char **src_buf, size_t > > *

Re: [PATCH 02/26] pkt-line: introduce struct packet_reader

2018-01-09 Thread Jonathan Tan
On Tue, 2 Jan 2018 16:18:04 -0800 Brandon Williams wrote: > diff --git a/pkt-line.h b/pkt-line.h > index 06c468927..c446e886a 100644 > --- a/pkt-line.h > +++ b/pkt-line.h > @@ -111,6 +111,63 @@ char *packet_read_line_buf(char **src_buf, size_t > *src_len, int *size); > */ > ssize_t read_pack

[PATCH 02/26] pkt-line: introduce struct packet_reader

2018-01-02 Thread Brandon Williams
Sometimes it is advantageous to be able to peek the next packet line without consuming it (e.g. to be able to determine the protocol version a server is speaking). In order to do that introduce 'struct packet_reader' which is an abstraction around the normal packet reading logic. This enables a c