From a42a8a2321bfb1d32599206f70105b085d08387e Mon Sep 17 00:00:00 2001 From: "Robert G. Jakabosky" Date: Sat, 1 Sep 2018 02:15:36 +0800 Subject: [PATCH] Add some comments to clarify logic. --- src/client/parser.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/client/parser.rs b/src/client/parser.rs index 7348de32a..b6f4ea3f7 100644 --- a/src/client/parser.rs +++ b/src/client/parser.rs @@ -39,6 +39,7 @@ impl HttpResponseParser { T: IoStream, { loop { + // Read some more data into the buffer for the parser. match io.read_available(buf) { Ok(Async::Ready((false, true))) => { return Err(HttpResponseParserError::Disconnect) @@ -49,6 +50,8 @@ impl HttpResponseParser { return Err(HttpResponseParserError::Error(err.into())) } } + + // Call HTTP response parser. match HttpResponseParser::parse_message(buf) .map_err(HttpResponseParserError::Error)? { @@ -60,6 +63,7 @@ impl HttpResponseParser { if buf.capacity() >= MAX_BUFFER_SIZE { return Err(HttpResponseParserError::Error(ParseError::TooLarge)); } + // Parser needs more data. Loop and read more data. } } }