Hi, Brandon Williams wrote: > 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 caller to be able to peek a single line at a time > using 'packet_reader_peek()' and having a caller consume a line by > calling 'packet_reader_read()'. > > Signed-off-by: Brandon Williams <bmwill@xxxxxxxxxx> > --- > pkt-line.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > pkt-line.h | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 117 insertions(+) I like it! The questions and nits from https://public-inbox.org/git/20180213004937.GB42272@xxxxxxxxxxxxxxxxxxxxxxxxx/ still apply. In particular, the ownership of the buffers inside the 'struct packet_reader' is still unclear; could the packet_reader create its own (strbuf) buffers so that the contract around them (who is allowed to write to them; who is responsible for freeing them) is more obvious? Thanks, Jonathan