static JSValue ngx_http_qjs_request_make(JSContext *cx, ngx_int_t proto_id,
ngx_http_request_t *r);
static void ngx_http_qjs_request_finalizer(JSRuntime *rt, JSValue val);
+static void ngx_http_qjs_periodic_finalizer(JSRuntime *rt, JSValue val);
#endif
static ngx_pool_t *ngx_http_js_pool(ngx_http_request_t *r);
static JSClassDef ngx_http_qjs_periodic_class = {
"PeriodicSession",
- .finalizer = NULL,
+ .finalizer = ngx_http_qjs_periodic_finalizer,
};
}
+static void
+ngx_http_qjs_periodic_finalizer(JSRuntime *rt, JSValue val)
+{
+ ngx_http_qjs_request_t *req;
+
+ req = JS_GetOpaque(val, NGX_QJS_CLASS_ID_HTTP_PERIODIC);
+ if (req == NULL) {
+ return;
+ }
+
+ js_free_rt(rt, req);
+}
+
+
static ngx_engine_t *
ngx_engine_qjs_clone(ngx_js_ctx_t *ctx, ngx_js_loc_conf_t *cf,
njs_int_t proto_id, void *external)
static JSValue ngx_stream_qjs_session_make(JSContext *cx, ngx_int_t proto_id,
ngx_stream_session_t *s);
static void ngx_stream_qjs_session_finalizer(JSRuntime *rt, JSValue val);
+static void ngx_stream_qjs_periodic_finalizer(JSRuntime *rt, JSValue val);
#endif
static JSClassDef ngx_stream_qjs_periodic_class = {
"Periodic",
- .finalizer = NULL,
+ .finalizer = ngx_stream_qjs_periodic_finalizer,
};
}
+static void
+ngx_stream_qjs_periodic_finalizer(JSRuntime *rt, JSValue val)
+{
+ ngx_stream_qjs_session_t *ses;
+
+ ses = JS_GetOpaque(val, NGX_QJS_CLASS_ID_STREAM_PERIODIC);
+ if (ses == NULL) {
+ return;
+ }
+
+ js_free_rt(rt, ses);
+}
+
+
static ngx_engine_t *
ngx_engine_qjs_clone(ngx_js_ctx_t *ctx, ngx_js_loc_conf_t *cf,
njs_int_t proto_id, void *external)