@@ -119,24 +119,17 @@ async fn run(opt: Opt) -> Result<()> {
119119
120120 let stream_stats = OpenStreamStats :: default ( ) ;
121121
122- let quinn:: NewConnection {
123- connection,
124- uni_streams,
125- ..
126- } = endpoint
122+ let connection = endpoint
127123 . connect_with ( cfg, addr, host_name) ?
128124 . await
129125 . context ( "connecting" ) ?;
130126
131127 info ! ( "established" ) ;
132128
133- let acceptor = UniAcceptor ( Arc :: new ( tokio:: sync:: Mutex :: new ( uni_streams) ) ) ;
134-
135129 let drive_fut = async {
136130 tokio:: try_join!(
137131 drive_uni(
138132 connection. clone( ) ,
139- acceptor,
140133 stream_stats. clone( ) ,
141134 opt. uni_requests,
142135 opt. upload_size,
@@ -236,7 +229,6 @@ async fn drain_stream(
236229
237230async fn drive_uni (
238231 connection : quinn:: Connection ,
239- acceptor : UniAcceptor ,
240232 stream_stats : OpenStreamStats ,
241233 concurrency : u64 ,
242234 upload : u64 ,
@@ -247,12 +239,12 @@ async fn drive_uni(
247239 loop {
248240 let permit = sem. clone ( ) . acquire_owned ( ) . await . unwrap ( ) ;
249241 let send = connection. open_uni ( ) . await ?;
250- let acceptor = acceptor. clone ( ) ;
251242 let stream_stats = stream_stats. clone ( ) ;
252243
253244 debug ! ( "sending request on {}" , send. id( ) ) ;
245+ let connection = connection. clone ( ) ;
254246 tokio:: spawn ( async move {
255- if let Err ( e) = request_uni ( send, acceptor , upload, download, stream_stats) . await {
247+ if let Err ( e) = request_uni ( send, connection , upload, download, stream_stats) . await {
256248 error ! ( "sending request failed: {:#}" , e) ;
257249 }
258250
@@ -263,19 +255,13 @@ async fn drive_uni(
263255
264256async fn request_uni (
265257 send : quinn:: SendStream ,
266- acceptor : UniAcceptor ,
258+ conn : quinn :: Connection ,
267259 upload : u64 ,
268260 download : u64 ,
269261 stream_stats : OpenStreamStats ,
270262) -> Result < ( ) > {
271263 request ( send, upload, download, stream_stats. clone ( ) ) . await ?;
272- let recv = {
273- let mut guard = acceptor. 0 . lock ( ) . await ;
274- guard
275- . next ( )
276- . await
277- . ok_or_else ( || anyhow:: anyhow!( "End of stream" ) )
278- } ??;
264+ let recv = conn. accept_uni ( ) . await ?;
279265 drain_stream ( recv, download, stream_stats) . await ?;
280266 Ok ( ( ) )
281267}
@@ -348,9 +334,6 @@ async fn request_bi(
348334 Ok ( ( ) )
349335}
350336
351- #[ derive( Clone ) ]
352- struct UniAcceptor ( Arc < tokio:: sync:: Mutex < quinn:: IncomingUniStreams > > ) ;
353-
354337struct SkipServerVerification ;
355338
356339impl SkipServerVerification {
0 commit comments