Hey, who can explain this function's behavior? Am I using this wrong? It always returns NULL, though I 100% ensured, there should be. Is here any way to list all nodes in the rbtree?
static int purge_from_cache(ngx_slab_pool_t *shpool, ngx_rbtree_t *rbtree, ngx_str_t ip, ngx_http_request_t *r) { uint32_t hash; ngx_http_hostprotect_value_node_t *found; hash = ngx_crc32_long(ip.data, ip.len); ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "%s: Trying to purge %s (%lu)", MODULE_NAME, ip.data, (unsigned long)hash); ngx_shmtx_lock(&shpool->mutex); found = (ngx_http_hostprotect_value_node_t *) ngx_str_rbtree_lookup(rbtree, &ip, hash); ngx_shmtx_unlock(&shpool->mutex); if(found) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "%s: Purging from active cache %s", MODULE_NAME, ip.data); ngx_shmtx_lock(&shpool->mutex); ngx_rbtree_delete(rbtree, found); ngx_slab_free_locked(shpool, found); ngx_shmtx_unlock(&shpool->mutex); return 1; } return 0; } -- Donatas
_______________________________________________ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel