Fix reading bug
This commit is contained in:
@@ -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:?}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user