Fix reading bug

This commit is contained in:
2026-07-22 23:26:49 +02:00
parent 34a4d817b9
commit 2ff5adfdaf
2 changed files with 6 additions and 4 deletions
+5 -3
View File
@@ -76,9 +76,11 @@ impl TerminalServer {
) -> tokio::io::Result<()> {
let msg = message.to_com();
for i in (0..self.clients.lock().await.len()).rev() {
if let Err(e) = self.clients.lock().await[i].write(&msg).await {
self.clients.lock().await.remove(i);
let mut clients = self.clients.lock().await;
for i in (0..clients.len()).rev() {
if let Err(e) = clients[i].write(&msg).await {
clients.remove(i);
println!("{e:?}");
}
}
+1 -1
View File
@@ -50,7 +50,7 @@ impl TerminalClient {
tokio::spawn(async move {
loop {
let mut buffer = Vec::new();
let mut buffer = vec![0u8; 4096];
let len = reader
.read(&mut buffer)