File tree Expand file tree Collapse file tree 1 file changed +9
-12
lines changed Expand file tree Collapse file tree 1 file changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -25,17 +25,15 @@ where
2525{
2626 async fn run ( mut self , store : & Accessor < T , U > ) -> wasmtime:: Result < ( ) > {
2727 let mut buf = BytesMut :: with_capacity ( 8192 ) ;
28- let mut tx = self . tx ;
29- loop {
28+ while !self . tx . is_closed ( ) {
3029 match self . rx . read_buf ( & mut buf) . await {
3130 Ok ( 0 ) => return Ok ( ( ) ) ,
3231 Ok ( _) => {
33- let ( Some ( tx_next) , buf_next) = tx. write_all ( store, Cursor :: new ( buf) ) . await
34- else {
35- break Ok ( ( ) ) ;
36- } ;
37- tx = tx_next;
38- buf = buf_next. into_inner ( ) ;
32+ buf = self
33+ . tx
34+ . write_all ( store, Cursor :: new ( buf) )
35+ . await
36+ . into_inner ( ) ;
3937 buf. clear ( ) ;
4038 }
4139 Err ( _err) => {
4442 }
4543 }
4644 }
45+ Ok ( ( ) )
4746 }
4847}
4948
5958{
6059 async fn run ( mut self , store : & Accessor < T , U > ) -> wasmtime:: Result < ( ) > {
6160 let mut buf = BytesMut :: with_capacity ( 8192 ) ;
62- let mut rx = self . rx ;
63- while let ( Some ( rx_next) , buf_next) = rx. read ( store, buf) . await {
64- buf = buf_next;
65- rx = rx_next;
61+ while !self . rx . is_closed ( ) {
62+ buf = self . rx . read ( store, buf) . await ;
6663 match self . tx . write_all ( & buf) . await {
6764 Ok ( ( ) ) => {
6865 buf. clear ( ) ;
You can’t perform that action at this time.
0 commit comments