mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
handle the expected error from the disconnect call
When disconnecting from a remote server that was destroyed, we would expect (and get) a ServerNotFound error.
This commit is contained in:
parent
2885890ee2
commit
60b0e3df87
1 changed files with 12 additions and 3 deletions
|
|
@ -227,9 +227,18 @@ fn xmain() -> ! {
|
|||
let mut cid_to_disconnect: Option<CID> = None;
|
||||
loop {
|
||||
let mut msg = xous::receive_message(net_sid).unwrap();
|
||||
if let Some(_dc_cid) = cid_to_disconnect.take() { // disconnect previous loop iter's connection after d/c OK response was sent
|
||||
// CHECK WITH XOBS: maybe these connections are auto-closed when the server is destroyed?
|
||||
// unsafe{xous::disconnect(dc_cid).expect("couldn't disconnect from dropped UDP object")};
|
||||
if let Some(dc_cid) = cid_to_disconnect.take() { // disconnect previous loop iter's connection after d/c OK response was sent
|
||||
unsafe{
|
||||
match xous::disconnect(dc_cid) {
|
||||
Ok(_) => {},
|
||||
Err(xous::Error::ServerNotFound) => {
|
||||
log::trace!("Disconnect returned the expected error code for a remote that has been destroyed.")
|
||||
},
|
||||
Err(e) => {
|
||||
log::error!("Attempt to de-allocate CID to destroyed server met with error: {:?}", e);
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
match FromPrimitive::from_usize(msg.body.id()) {
|
||||
Some(Opcode::UdpBind) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue