aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--codecrafters.yml2
-rw-r--r--src/main.rs9
2 files changed, 5 insertions, 6 deletions
diff --git a/codecrafters.yml b/codecrafters.yml
index 83a3898..99234a0 100644
--- a/codecrafters.yml
+++ b/codecrafters.yml
@@ -2,7 +2,7 @@
#
# These can be VERY verbose, so we suggest turning them off
# unless you really need them.
-debug: false
+debug: true
# Use this to change the Rust version used to run your code
# on Codecrafters.
diff --git a/src/main.rs b/src/main.rs
index 464716f..5c89f41 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -10,11 +10,10 @@ fn main() {
for stream in listener.incoming() {
match stream {
Ok(mut stream) => {
- let mut buf = [0; 128];
- stream.read(&mut buf).unwrap();
- let request = str::from_utf8(&buf).unwrap();
- for _ in 0..request.matches("PING").count() {
- stream.write_all(b"+PONG\r\n").unwrap();
+ let mut buf = [0; 512];
+ loop {
+ let _ = stream.read(&mut buf).unwrap();
+ stream.write(b"+PONG\r\n").unwrap();
}
}
Err(e) => {