diff --git a/src/filter/http_context.rs b/src/filter/http_context.rs index e7fd0d7..787df8e 100644 --- a/src/filter/http_context.rs +++ b/src/filter/http_context.rs @@ -82,6 +82,21 @@ impl Filter { } } } + + fn process_next_op(&self) { + match self.operation_dispatcher.borrow_mut().next() { + Ok(some_op) => { + if some_op.is_none() { + // No more operations left in queue, resuming + self.resume_http_request(); + } + } + Err(op_err) => { + // If desired, we could check the error status. + GrpcService::handle_error_on_grpc_response(op_err.failure_mode); + } + } + } } impl HttpContext for Filter { @@ -134,21 +149,21 @@ impl Context for Filter { match op_res { Ok(operation) => { - if let Ok(result) = GrpcService::process_grpc_response(operation, resp_size) { - // add the response headers - self.response_headers_to_add.extend(result.response_headers); - // call the next op - match self.operation_dispatcher.borrow_mut().next() { - Ok(some_op) => { - if some_op.is_none() { - // No more operations left in queue, resuming - self.resume_http_request(); + match GrpcService::process_grpc_response(Rc::clone(&operation), resp_size) { + Ok(result) => { + // add the response headers + self.response_headers_to_add.extend(result.response_headers); + // call the next op + self.process_next_op(); + } + Err(_) => { + match operation.get_failure_mode() { + FailureMode::Deny => {} + FailureMode::Allow => { + // call the next op + self.process_next_op(); } } - Err(op_err) => { - // If desired, we could check the error status. - GrpcService::handle_error_on_grpc_response(op_err.failure_mode); - } } } } diff --git a/src/service.rs b/src/service.rs index 461ecc2..1145c1e 100644 --- a/src/service.rs +++ b/src/service.rs @@ -100,9 +100,7 @@ impl GrpcService { hostcalls::send_http_response(500, vec![], Some(b"Internal Server Error.\n")) .expect("failed to send_http_response 500"); } - FailureMode::Allow => { - hostcalls::resume_http_request().expect("failed to resume_http_request") - } + FailureMode::Allow => {} } } }