From c032f9a4e503a08961322202aaa18993458fe595 Mon Sep 17 00:00:00 2001 From: fengzero Date: Mon, 1 Aug 2022 02:58:07 +0000 Subject: [PATCH] fix: http aio cancel fn --- plugins/restful/handle.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/restful/handle.h b/plugins/restful/handle.h index c03e321c..86bb4eab 100644 --- a/plugins/restful/handle.h +++ b/plugins/restful/handle.h @@ -32,8 +32,6 @@ size_t req_data_size = 0; \ req_type *req = NULL; \ \ - nng_aio_set_timeout(aio, 3000); \ - nng_aio_defer(aio, http_timeout, NULL); \ if (http_get_body((aio), (void **) &req_data, &req_data_size) == 0 && \ decode_fun(req_data, &req) == 0) { \ { func }; \ @@ -47,6 +45,8 @@ #define REST_PROCESS_HTTP_REQUEST_VALIDATE_JWT(aio, req_type, decode_fun, \ func) \ { \ + nng_aio_set_timeout(aio, 3000); \ + nng_aio_defer(aio, http_timeout, NULL); \ char *jwt = (char *) http_get_header(aio, (char *) "Authorization"); \ \ NEU_JSON_RESPONSE_ERROR(neu_jwt_validate(jwt), { \ @@ -61,6 +61,8 @@ #define VALIDATE_JWT(aio) \ { \ + nng_aio_set_timeout(aio, 3000); \ + nng_aio_defer(aio, http_timeout, NULL); \ char *jwt = (char *) http_get_header(aio, (char *) "Authorization"); \ \ NEU_JSON_RESPONSE_ERROR(neu_jwt_validate(jwt), { \