File tree Expand file tree Collapse file tree 3 files changed +29
-11
lines changed Expand file tree Collapse file tree 3 files changed +29
-11
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,9 @@ sessions = ["async-session", "cookies"]
3333unstable = []
3434
3535[dependencies ]
36- async-h1 = { version = " 2.3.0" , optional = true }
36+ # async-h1 = { version = "2.3.0", optional = true }
37+ # FIXME: for proposal purpose only
38+ async-h1 = { git = " https://github.com/pbzweihander/async-h1.git" , branch = " cancellation" , optional = true }
3739async-session = { version = " 3.0" , optional = true }
3840async-sse = " 4.0.1"
3941async-std = { version = " 1.6.5" , features = [" unstable" ] }
Original file line number Diff line number Diff line change @@ -58,11 +58,19 @@ fn handle_tcp<State: Clone + Send + Sync + 'static>(
5858 let local_addr = stream. local_addr ( ) . ok ( ) ;
5959 let peer_addr = stream. peer_addr ( ) . ok ( ) ;
6060
61- let fut = async_h1:: accept ( stream, |mut req| async {
62- req. set_local_addr ( local_addr) ;
63- req. set_peer_addr ( peer_addr) ;
64- app. respond ( req) . await
65- } ) ;
61+ let opts = async_h1:: ServerOptions {
62+ stopper : app. stopper . clone ( ) ,
63+ ..Default :: default ( )
64+ } ;
65+ let fut = async_h1:: accept_with_opts (
66+ stream,
67+ |mut req| async {
68+ req. set_local_addr ( local_addr) ;
69+ req. set_peer_addr ( peer_addr) ;
70+ app. respond ( req) . await
71+ } ,
72+ opts,
73+ ) ;
6674
6775 if let Err ( error) = fut. await {
6876 log:: error!( "async-h1 error" , { error: error. to_string( ) } ) ;
Original file line number Diff line number Diff line change @@ -59,11 +59,19 @@ fn handle_unix<State: Clone + Send + Sync + 'static>(
5959 let local_addr = unix_socket_addr_to_string ( stream. local_addr ( ) ) ;
6060 let peer_addr = unix_socket_addr_to_string ( stream. peer_addr ( ) ) ;
6161
62- let fut = async_h1:: accept ( stream, |mut req| async {
63- req. set_local_addr ( local_addr. as_ref ( ) ) ;
64- req. set_peer_addr ( peer_addr. as_ref ( ) ) ;
65- app. respond ( req) . await
66- } ) ;
62+ let opts = async_h1:: ServerOptions {
63+ stopper : app. stopper . clone ( ) ,
64+ ..Default :: default ( )
65+ } ;
66+ let fut = async_h1:: accept_with_opts (
67+ stream,
68+ |mut req| async {
69+ req. set_local_addr ( local_addr. as_ref ( ) ) ;
70+ req. set_peer_addr ( peer_addr. as_ref ( ) ) ;
71+ app. respond ( req) . await
72+ } ,
73+ opts,
74+ ) ;
6775
6876 if let Err ( error) = fut. await {
6977 log:: error!( "async-h1 error" , { error: error. to_string( ) } ) ;
You can’t perform that action at this time.
0 commit comments