Commit a50bee71 authored by Wandenberg Peixoto's avatar Wandenberg Peixoto

refactor to put code responsable to free channel memory in a different function

parent ec18573c
......@@ -25,6 +25,8 @@
#include <ngx_http_push_stream_module_utils.h>
static void nxg_http_push_stream_free_channel_memory_locked(ngx_slab_pool_t *shpool, ngx_http_push_stream_channel_t *channel);
static ngx_inline void
ngx_http_push_stream_ensure_qtd_of_messages_locked(ngx_http_push_stream_channel_t *channel, ngx_uint_t max_messages, ngx_flag_t expired) {
ngx_http_push_stream_msg_t *sentinel, *msg;
......@@ -299,6 +301,15 @@ ngx_http_push_stream_free_memory_of_expired_channels_locked(ngx_rbtree_t *tree,
if ((ngx_time() > channel->expires) || force) {
ngx_rbtree_delete(tree, node);
nxg_http_push_stream_free_channel_memory_locked(shpool, channel);
}
}
}
static void
nxg_http_push_stream_free_channel_memory_locked(ngx_slab_pool_t *shpool, ngx_http_push_stream_channel_t *channel)
{
// delete the worker-subscriber queue
ngx_http_push_stream_pid_queue_t *workers_sentinel, *cur, *next;
......@@ -314,8 +325,6 @@ ngx_http_push_stream_free_memory_of_expired_channels_locked(ngx_rbtree_t *tree,
ngx_slab_free_locked(shpool, channel->id.data);
ngx_slab_free_locked(shpool, channel);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment