Handle robot disconnects more cleanly

main
Joey Hines 2024-06-22 19:37:36 -06:00
parent 6129060319
commit cf64eafcb5
No known key found for this signature in database
GPG Key ID: 995E531F7A569DDB
1 changed files with 14 additions and 1 deletions

View File

@ -92,7 +92,20 @@ impl RobotManager {
return Err(Error::ConnectionClosed(*id));
}
let resp = recv_raas_msg(&mut connector.stream).await?;
let ret = recv_raas_msg(&mut connector.stream).await;
let resp = match ret {
Ok(r) => r,
Err(err) => {
error!(
"Got '{}' receiving message to Robot Connector id={}, closing connection",
err, id
);
return Err(Error::ConnectionClosed(*id));
}
};
info!("Got response from id={}", id);
self.send_resp(resp).await?;
} else {