Skip to content

Commit 1e5b129

Browse files
committed
async-server: break the flow when errors found in handle_request
Fix the bug that does not break the handle flow of request when invalid-argument error found. Signed-off-by: Tim Zhang <tim@hyper.sh>
1 parent eef2004 commit 1e5b129

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/asynchronous/server.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,13 +305,19 @@ async fn handle_request(
305305
if let Err(x) = respond_with_status(tx.clone(), header.stream_id, status).await {
306306
error!("respond get error {:?}", x);
307307
}
308+
309+
return;
308310
}
309311
trace!("Got Message request {:?}", req);
310312

311313
let path = format!("/{}/{}", req.service, req.method);
312314
if let Some(x) = methods.get(&path) {
313315
let method = x;
314-
let ctx = TtrpcContext { fd, mh: header, metadata: context::from_pb(&req.metadata) };
316+
let ctx = TtrpcContext {
317+
fd,
318+
mh: header,
319+
metadata: context::from_pb(&req.metadata),
320+
};
315321

316322
match method.handler(ctx, req).await {
317323
Ok((stream_id, body)) => {

0 commit comments

Comments
 (0)