Skip to content

Commit

Permalink
Merge pull request #1289 from plebhash/fix-sv1-cpu-tcp-unwrap
Browse files Browse the repository at this point in the history
fix unwrap on `sv1-mining-device` tcp connection
  • Loading branch information
GitGab19 authored Dec 11, 2024
2 parents 6b105cf + 3678bb1 commit aeacb0e
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions roles/test-utils/mining-device-sv1/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,20 @@ impl Client {
task::spawn(async move {
let mut messages = BufReader::new(&*reader).lines();
while let Some(message) = messages.next().await {
let message = message.unwrap();
sender_incoming.send(message).await.unwrap();
match message {
Ok(msg) => {
if let Err(e) = sender_incoming.send(msg).await {
eprintln!("Failed to send message to receiver_incoming: {:?}", e);
break; // Exit the loop if sending fails
}
}
Err(e) => {
eprintln!("Error reading from socket: {:?}", e);
break; // Exit the loop on read failure
}
}
}
eprintln!("Reader task terminated.");
});

// Waits to receive a message from `sender_outgoing` and writes it to the socket for the
Expand Down

0 comments on commit aeacb0e

Please sign in to comment.