Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

Commit

Permalink
clear buffer after each read
Browse files Browse the repository at this point in the history
  • Loading branch information
pwbh committed Aug 30, 2023
1 parent 9272933 commit 68977d6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion observer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ fn main() -> Result<(), String> {
}
};

let mut reader = BufReader::new(&leader_stream);
let mut reader: BufReader<&mut TcpStream> = BufReader::new(&mut leader_stream);
let mut buf = String::with_capacity(1024);

loop {
Expand All @@ -142,6 +142,8 @@ fn main() -> Result<(), String> {
Ok(_) => println!("Received delgated cluster metadata successfully"),
Err(e) => println!("Cluster metadata delegation error: {}", e),
};

buf.clear();
}
} else {
// This will make sure our main thread will never exit until the user will issue an EXIT command by himself
Expand Down

0 comments on commit 68977d6

Please sign in to comment.