mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
Merge pull request #179 from betrusted-io/fix-forward-memory
xous: envelope: handle MemoryReturned in forward()
This commit is contained in:
commit
b3ea67a2a9
1 changed files with 8 additions and 10 deletions
|
|
@ -124,21 +124,19 @@ impl Envelope {
|
|||
));
|
||||
}
|
||||
|
||||
_ => {
|
||||
Message::Borrow(_) | Message::MutableBorrow(_) | Message::Scalar(_) => {
|
||||
let result = crate::send_message(connection, body);
|
||||
let new_self = ManuallyDrop::into_inner(manual_self);
|
||||
|
||||
if let Ok(crate::Result::Ok) = result {
|
||||
match result {
|
||||
// `new_self` will have its Drop() called
|
||||
return Ok(());
|
||||
}
|
||||
Ok(crate::Result::Ok) | Ok(crate::Result::MemoryReturned(_, _)) => Ok(()),
|
||||
|
||||
// If there's an error, reconstitute ourselves and return.
|
||||
if let Err(e) = result {
|
||||
return Err((new_self, e));
|
||||
}
|
||||
// If there's an error, reconstitute ourselves and return.
|
||||
Err(e) => Err((new_self, e)),
|
||||
|
||||
return Err((new_self, crate::Error::MemoryInUse));
|
||||
// Any other value is a bug in the kernel
|
||||
o => panic!("unrecognized return from send_message: {:?}", o),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue