File tree Expand file tree Collapse file tree 1 file changed +14
-18
lines changed Expand file tree Collapse file tree 1 file changed +14
-18
lines changed Original file line number Diff line number Diff line change @@ -115,24 +115,20 @@ fn main() {
115
115
process:: exit ( 0 ) ;
116
116
} ) ;
117
117
118
- let s = service. clone ( ) ;
119
- let server =
120
- hyper:: server:: Server :: bind ( & addr) . serve ( hyper:: service:: make_service_fn ( move |_| {
121
- let s = s. clone ( ) ;
122
- async move {
123
- Ok :: < _ , hyper:: Error > ( hyper:: service:: service_fn ( move |req| {
124
- let s = s. clone ( ) ;
125
- async move { s. call ( req) . await }
126
- } ) )
127
- }
128
- } ) ) ;
129
-
130
- tokio:: runtime:: Runtime :: new ( ) ?
131
- . block_on ( server)
132
- . map_err ( |e| {
133
- error ! ( "server error: {}" , e) ;
134
- e
135
- } ) ?;
118
+ tokio:: runtime:: Runtime :: new ( ) ?. block_on ( async move {
119
+ let s = service. clone ( ) ;
120
+ hyper:: server:: Server :: bind ( & addr)
121
+ . serve ( hyper:: service:: make_service_fn ( move |_| {
122
+ let s = s. clone ( ) ;
123
+ async move {
124
+ Ok :: < _ , hyper:: Error > ( hyper:: service:: service_fn ( move |req| {
125
+ let s = s. clone ( ) ;
126
+ async move { s. call ( req) . await }
127
+ } ) )
128
+ }
129
+ } ) )
130
+ . await
131
+ } ) ?;
136
132
137
133
Ok ( ( ) )
138
134
} ) ;
You can’t perform that action at this time.
0 commit comments