diff options
author | 2023-04-25 22:09:56 -0700 | |
---|---|---|
committer | 2023-04-25 22:09:56 -0700 | |
commit | b957087fe64b41624ebf0edb278f0df6adf7d846 (patch) | |
tree | 4b852f6cd8aac38912e4c309d89027d030b46fc6 | |
parent | 88d47cceb41356cb066b9f9ad33e69d38efc43f8 (diff) | |
download | bun-b957087fe64b41624ebf0edb278f0df6adf7d846.tar.gz bun-b957087fe64b41624ebf0edb278f0df6adf7d846.tar.zst bun-b957087fe64b41624ebf0edb278f0df6adf7d846.zip |
Make it clearer this refers to JS request object
-rw-r--r-- | src/bun.js/api/server.zig | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/bun.js/api/server.zig b/src/bun.js/api/server.zig index 58cdc8b63..b6c65719e 100644 --- a/src/bun.js/api/server.zig +++ b/src/bun.js/api/server.zig @@ -921,7 +921,7 @@ fn NewRequestContext(comptime ssl_enabled: bool, comptime debug_mode: bool, comp method: HTTP.Method, aborted: bool = false, finalized: bun.DebugOnly(bool) = bun.DebugOnlyDefault(false), - request_finalization_callback: ?*JSC.FinalizationCallback = null, + request_object_finalization_callback: ?*JSC.FinalizationCallback = null, upgrade_context: ?*uws.uws_socket_context_t = null, /// We can only safely free once the request body promise is finalized @@ -976,9 +976,9 @@ fn NewRequestContext(comptime ssl_enabled: bool, comptime debug_mode: bool, comp this.resp.onAborted(*RequestContext, RequestContext.onAbort, this); } - pub fn onRequestFinalized(this: *RequestContext) void { + pub fn onJSRequestObjectFinalized(this: *RequestContext) void { this.request_js_object = null; - this.request_finalization_callback = null; + this.request_object_finalization_callback = null; } pub fn onResolve(_: *JSC.JSGlobalObject, callframe: *JSC.CallFrame) callconv(.C) JSValue { @@ -1333,10 +1333,10 @@ fn NewRequestContext(comptime ssl_enabled: bool, comptime debug_mode: bool, comp // User called .blob(), .json(), text(), or .arrayBuffer() on the Request object // but we received nothing or the connection was aborted if (request_js.as(Request)) |req| { - if (this.request_finalization_callback) |finalizer| { + if (this.request_object_finalization_callback) |finalizer| { finalizer.detach(this.server.vm.finalizationPool()); req.finalization_callback = null; - this.request_finalization_callback = null; + this.request_object_finalization_callback = null; } // the promise is pending @@ -1422,12 +1422,12 @@ fn NewRequestContext(comptime ssl_enabled: bool, comptime debug_mode: bool, comp // User called .blob(), .json(), text(), or .arrayBuffer() on the Request object // but we received nothing or the connection was aborted if (request_js.as(Request)) |req| { - if (this.request_finalization_callback) |finalizer| { + if (this.request_object_finalization_callback) |finalizer| { finalizer.detach(this.server.vm.finalizationPool()); - if (finalizer == this.request_finalization_callback) + if (finalizer == this.request_object_finalization_callback) req.finalization_callback = null; - this.request_finalization_callback = null; + this.request_object_finalization_callback = null; } // the promise is pending @@ -2142,12 +2142,12 @@ fn NewRequestContext(comptime ssl_enabled: bool, comptime debug_mode: bool, comp if (ctx.signal == null) { if (request_object.signal) |signal| { ctx.signal = signal.ref(); - } else if (ctx.request_finalization_callback == null and request_object.finalization_callback == null) { + } else if (ctx.request_object_finalization_callback == null and request_object.finalization_callback == null) { request_object.finalization_callback = JSC.FinalizationCallback.create( this.vm.finalizationPool(), RequestContext, ctx, - RequestContext.onRequestFinalized, + RequestContext.onJSRequestObjectFinalized, ); } } |