Skip to content

Commit 9a88709

Browse files
committed
reviewed the code and caught the bug!
1 parent 4a650a2 commit 9a88709

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

part2/src/telnet.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ impl Decoder for Telnet {
5656
while let Some(n) = src.iter().position(|&b| b == ESCAPE) {
5757
let next = match src.get(n + 1).map(|&x| TelnetCommand::try_from(x).ok()) {
5858
Some(Some(b)) => b,
59-
Some(None) => continue,
59+
Some(None) => {
60+
buf.extend_from_slice(&src[..n]);
61+
src.advance(n + 2);
62+
continue;
63+
},
6064
None => return Ok(None)
6165
};
6266
match next {

0 commit comments

Comments
 (0)