File tree Expand file tree Collapse file tree 3 files changed +6
-4
lines changed Expand file tree Collapse file tree 3 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -23,3 +23,5 @@ compio-buf = { workspace = true }
23
23
compio-io = { workspace = true }
24
24
compio-net = { workspace = true }
25
25
compio-macros = { workspace = true }
26
+
27
+ futures-util = { workspace = true }
Original file line number Diff line number Diff line change @@ -29,12 +29,12 @@ async fn listener_dispatch() {
29
29
for _i in 0 ..CLIENT_NUM {
30
30
let ( mut srv, _) = listener. accept ( ) . await . unwrap ( ) ;
31
31
let handle = dispatcher
32
- . execute ( move || async move {
32
+ . dispatch ( move || async move {
33
33
let ( _, buf) = srv. read_exact ( ArrayVec :: < u8 , 12 > :: new ( ) ) . await . unwrap ( ) ;
34
34
assert_eq ! ( buf. as_slice( ) , b"Hello world!" ) ;
35
35
} )
36
36
. unwrap ( ) ;
37
- handles. push ( handle. join ( ) ) ;
37
+ handles. push ( handle) ;
38
38
}
39
39
while handles. next ( ) . await . is_some ( ) { }
40
40
let ( _, results) = futures_util:: join!( task, dispatcher. join( ) ) ;
Original file line number Diff line number Diff line change @@ -35,13 +35,13 @@ async fn main() {
35
35
for _i in 0 ..CLIENT_NUM {
36
36
let ( mut srv, _) = listener. accept ( ) . await . unwrap ( ) ;
37
37
let handle = dispatcher
38
- . execute ( move || async move {
38
+ . dispatch ( move || async move {
39
39
let BufResult ( res, buf) = srv. read ( Vec :: with_capacity ( 20 ) ) . await ;
40
40
res. unwrap ( ) ;
41
41
println ! ( "{}" , std:: str :: from_utf8( & buf) . unwrap( ) ) ;
42
42
} )
43
43
. unwrap ( ) ;
44
- handles. push ( handle. join ( ) ) ;
44
+ handles. push ( handle) ;
45
45
}
46
46
while handles. next ( ) . await . is_some ( ) { }
47
47
dispatcher. join ( ) . await . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments