rkyv-test-server: support multiple callbacks for one client

There doesn't seem to be a compelling reason to limit clients to just
one callback.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2021-03-26 12:42:35 +08:00
parent c1fe20c06b
commit f58f82a40d

View file

@ -142,9 +142,8 @@ fn test_main() -> ! {
{ {
let sid = xous::SID::from_u32(arg1 as _, arg2 as _, arg3 as _, arg4 as _); let sid = xous::SID::from_u32(arg1 as _, arg2 as _, arg3 as _, arg4 as _);
let cb_conn = Some(xous::connect(sid).unwrap()); let cb_conn = Some(xous::connect(sid).unwrap());
// Add this callback connection to the list of callbacks if it doesn't // Add this callback connection to the list of callbacks. If `AddLogStringCallback`
// already exist. // is called multiple times, then it will receive multiple callbacks.
if !logstring_callback_connections.contains(&cb_conn) {
for entry in logstring_callback_connections.iter_mut() { for entry in logstring_callback_connections.iter_mut() {
if *entry == None { if *entry == None {
*entry = cb_conn; *entry = cb_conn;
@ -153,7 +152,6 @@ fn test_main() -> ! {
} }
} }
} }
}
None => (), None => (),
} }
} }