[njs] HTTP: simplified events handling.

Dmitry Volyntsev xeioex at nginx.com
Tue Aug 22 18:13:38 UTC 2023


details:   https://hg.nginx.org/njs/rev/4cb8e873e8c6
branches:  
changeset: 2183:4cb8e873e8c6
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Tue Aug 22 11:12:02 2023 -0700
description:
HTTP: simplified events handling.

diffstat:

 nginx/ngx_http_js_module.c |  15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)

diffs (51 lines):

diff -r 71bf45ec8f77 -r 4cb8e873e8c6 nginx/ngx_http_js_module.c
--- a/nginx/ngx_http_js_module.c	Tue Aug 22 11:12:01 2023 -0700
+++ b/nginx/ngx_http_js_module.c	Tue Aug 22 11:12:02 2023 -0700
@@ -255,8 +255,6 @@ static size_t ngx_http_js_max_response_b
     ngx_http_request_t *r);
 static void ngx_http_js_handle_vm_event(ngx_http_request_t *r,
     njs_vm_event_t vm_event, njs_value_t *args, njs_uint_t nargs);
-static void ngx_http_js_handle_event(ngx_http_request_t *r,
-    njs_vm_event_t vm_event, njs_value_t *args, njs_uint_t nargs);
 
 static njs_int_t ngx_js_http_init(njs_vm_t *vm);
 static ngx_int_t ngx_http_js_init(ngx_conf_t *cf);
@@ -791,7 +789,7 @@ static uintptr_t ngx_http_js_uptr[] = {
     (uintptr_t) ngx_http_js_pool,
     (uintptr_t) ngx_http_js_resolver,
     (uintptr_t) ngx_http_js_resolver_timeout,
-    (uintptr_t) ngx_http_js_handle_event,
+    (uintptr_t) ngx_http_js_handle_vm_event,
     (uintptr_t) ngx_http_js_ssl,
     (uintptr_t) ngx_http_js_ssl_verify,
     (uintptr_t) ngx_http_js_fetch_timeout,
@@ -4105,7 +4103,7 @@ ngx_http_js_timer_handler(ngx_event_t *e
 
     r = js_event->request;
 
-    ngx_http_js_handle_event(r, js_event->vm_event, NULL, 0);
+    ngx_http_js_handle_vm_event(r, js_event->vm_event, NULL, 0);
 }
 
 
@@ -4196,19 +4194,12 @@ ngx_http_js_handle_vm_event(ngx_http_req
                       "js exception: %V", &exception);
 
         ngx_http_finalize_request(r, NGX_ERROR);
+        return;
     }
 
     if (rc == NJS_OK) {
         ngx_http_post_request(r, NULL);
     }
-}
-
-
-static void
-ngx_http_js_handle_event(ngx_http_request_t *r, njs_vm_event_t vm_event,
-    njs_value_t *args, njs_uint_t nargs)
-{
-    ngx_http_js_handle_vm_event(r, vm_event, args, nargs);
 
     ngx_http_run_posted_requests(r->connection);
 }


More information about the nginx-devel mailing list