added a new test for comm

This commit is contained in:
2026-04-24 02:40:05 +00:00
parent 0bc7097c88
commit 759497ee70
7 changed files with 234 additions and 210 deletions

View File

@@ -17,7 +17,7 @@ use hashbrown::{HashMap, HashSet};
use itertools::Itertools;
use orchid_api_traits::{Decode, Encode, Request};
use orchid_base::{
AtomRepr, Client, ClientExt, CommCtx, FmtCtxImpl, Format, IStr, IStrv, MsgReaderExt, Pos,
AtomRepr, Client, ClientExt, CommCx, FmtCtxImpl, Format, IStr, IStrv, IoComm, MsgReaderExt, Pos,
ReqHandleExt, ReqReaderExt, Sym, Witness, es, ev, io_comm, is, iv, log, stash, with_stash,
};
@@ -45,7 +45,7 @@ pub struct ReqPair<R: Request>(R, Sender<R::Response>);
pub struct ExtensionData {
name: String,
ctx: Ctx,
comm_cx: Option<CommCtx>,
comm_cx: Option<CommCx>,
join_ext: Option<Box<dyn JoinHandle>>,
client: Rc<dyn Client>,
systems: Vec<SystemCtor>,
@@ -82,12 +82,12 @@ impl Extension {
let header2 = header.clone();
Ok(Self(Rc::new_cyclic(|weak: &Weak<ExtensionData>| {
// context not needed because exit is extension-initiated
let (client, comm_cx, comm) = io_comm(init.input, init.output);
let IoComm { client, cx: comm_cx, srv } = io_comm(init.input, init.output);
let weak2 = weak;
let weak = weak.clone();
let ctx2 = ctx.clone();
let join_ext = ctx.clone().spawn(Duration::ZERO, async move {
comm
srv
.listen(
async |reader| {
with_stash(async {