Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultcha committed Oct 8, 2023
1 parent 87f41e0 commit 979dd72
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/common/proxy_wasm/ngx_proxy_wasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,9 @@ ngx_proxy_wasm_ctx_destroy(ngx_proxy_wasm_ctx_t *pwctx)

dd("enter (pwctx: %p)", pwctx);

if (pwctx->isolation == NGX_PROXY_WASM_ISOLATION_STREAM && pwctx->ready) {
if (pwctx->ready
&& pwctx->isolation == NGX_PROXY_WASM_ISOLATION_STREAM)
{
ngx_proxy_wasm_store_destroy(&pwctx->store);
}

Expand All @@ -336,9 +338,9 @@ ngx_proxy_wasm_ctx_destroy(ngx_proxy_wasm_ctx_t *pwctx)
if (pwctx->isolation == NGX_PROXY_WASM_ISOLATION_NONE) {
/* sweep if an instance has trapped */
ngx_proxy_wasm_store_sweep(pwexec->ictx->store);
}

if (pwctx->isolation == NGX_PROXY_WASM_ISOLATION_FILTER) {
} else if (pwctx->isolation == NGX_PROXY_WASM_ISOLATION_FILTER) {
/* destroy filter context store */
ngx_proxy_wasm_store_destroy(pwexec->store);
}
}
Expand Down Expand Up @@ -1089,9 +1091,7 @@ ngx_proxy_wasm_create_context(ngx_proxy_wasm_filter_t *filter,

if (id && (in == NULL || in->root_id != NGX_PROXY_WASM_ROOT_CTX_ID)) {
pwexec = ngx_proxy_wasm_lookup_ctx(ictx, id);

dd("pwexec for id %ld: %p", id, pwexec);

dd("pwexec for id %ld: %p (in: %p)", id, pwexec, in);
if (pwexec == NULL) {

if (in == NULL) {
Expand Down Expand Up @@ -1664,7 +1664,7 @@ static void
ngx_proxy_wasm_instance_invalidate(ngx_proxy_wasm_instance_t *ictx)
{
ngx_rbtree_node_t **root, **sentinel, *s, *n;
ngx_proxy_wasm_exec_t *pwexec = NULL;
ngx_proxy_wasm_exec_t *pwexec;

dd("enter (ictx: %p)", ictx);

Expand All @@ -1676,15 +1676,14 @@ ngx_proxy_wasm_instance_invalidate(ngx_proxy_wasm_instance_t *ictx)

while (*root != *sentinel) {
n = ngx_rbtree_min(*root, *sentinel);
#if 0
#if (NGX_DEBUG)
pwexec = ngx_rbtree_data(n, ngx_proxy_wasm_exec_t, node);

dd("invalidate root ctx #%ld instance (pwexec: %p)",
pwexec->id, pwexec);
#endif

ngx_rbtree_delete(&ictx->root_ctxs, n);

#if 0
destroy_pwexec(pwexec);
#endif
Expand Down Expand Up @@ -1734,10 +1733,9 @@ ngx_proxy_wasm_instance_destroy(ngx_proxy_wasm_instance_t *ictx)
rexec = ngx_rbtree_data(n, ngx_proxy_wasm_exec_t, node);

rexec->ictx = NULL;
rexec->started = 0;
//rexec->started = 0;

ngx_rbtree_delete(&ictx->root_ctxs, n);

#if 0
destroy_pwexec(rexec);
#endif
Expand All @@ -1754,7 +1752,7 @@ ngx_proxy_wasm_instance_destroy(ngx_proxy_wasm_instance_t *ictx)
ngx_wasm_assert(rexec->ev == NULL);

rexec->ictx = NULL;
rexec->started = 0;
//rexec->started = 0;

ngx_rbtree_delete(&ictx->tree_ctxs, n);
}
Expand Down

0 comments on commit 979dd72

Please sign in to comment.