Skip to content

Commit f1822c0

Browse files
committed
fix(dispatcher): example and test
1 parent d4aee9d commit f1822c0

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

compio-dispatcher/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ compio-buf = { workspace = true }
2323
compio-io = { workspace = true }
2424
compio-net = { workspace = true }
2525
compio-macros = { workspace = true }
26+
27+
futures-util = { workspace = true }

compio-dispatcher/tests/listener.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ async fn listener_dispatch() {
2929
for _i in 0..CLIENT_NUM {
3030
let (mut srv, _) = listener.accept().await.unwrap();
3131
let handle = dispatcher
32-
.execute(move || async move {
32+
.dispatch(move || async move {
3333
let (_, buf) = srv.read_exact(ArrayVec::<u8, 12>::new()).await.unwrap();
3434
assert_eq!(buf.as_slice(), b"Hello world!");
3535
})
3636
.unwrap();
37-
handles.push(handle.join());
37+
handles.push(handle);
3838
}
3939
while handles.next().await.is_some() {}
4040
let (_, results) = futures_util::join!(task, dispatcher.join());

compio/examples/dispatcher.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ async fn main() {
3535
for _i in 0..CLIENT_NUM {
3636
let (mut srv, _) = listener.accept().await.unwrap();
3737
let handle = dispatcher
38-
.execute(move || async move {
38+
.dispatch(move || async move {
3939
let BufResult(res, buf) = srv.read(Vec::with_capacity(20)).await;
4040
res.unwrap();
4141
println!("{}", std::str::from_utf8(&buf).unwrap());
4242
})
4343
.unwrap();
44-
handles.push(handle.join());
44+
handles.push(handle);
4545
}
4646
while handles.next().await.is_some() {}
4747
dispatcher.join().await.unwrap();

0 commit comments

Comments
 (0)