static void
ngx_http_push_stream_exit_master(ngx_cycle_t *cycle)
{
    ngx_http_push_stream_shm_data_t        *data = (ngx_http_push_stream_shm_data_t *) ngx_http_push_stream_shm_zone->data;
    ngx_slab_pool_t                        *shpool = (ngx_slab_pool_t *) ngx_http_push_stream_shm_zone->shm.addr;

    // destroy channel tree in shared memory
    ngx_http_push_stream_collect_expired_messages_and_empty_channels(&data->tree, shpool, data->tree.root, 1, 0);
    ngx_http_push_stream_free_memory_of_expired_messages_and_channels(1);
}
static void
ngx_http_push_stream_exit_master(ngx_cycle_t *cycle)
{
    if (!ngx_http_push_stream_enabled) {
        return;
    }

    // destroy channel tree in shared memory
    ngx_http_push_stream_collect_expired_messages_and_empty_channels(1);
    ngx_http_push_stream_free_memory_of_expired_messages_and_channels(1);
}
static void
ngx_http_push_stream_exit_master(ngx_cycle_t *cycle)
{
    if ((ngx_http_push_stream_module_main_conf == NULL) || !ngx_http_push_stream_module_main_conf->enabled) {
        return;
    }

    ngx_http_push_stream_shm_data_t        *data = (ngx_http_push_stream_shm_data_t *) ngx_http_push_stream_shm_zone->data;
    ngx_slab_pool_t                        *shpool = (ngx_slab_pool_t *) ngx_http_push_stream_shm_zone->shm.addr;

    // destroy channel tree in shared memory
    ngx_http_push_stream_collect_expired_messages_and_empty_channels(data, shpool, data->tree.root, 1);
    ngx_http_push_stream_free_memory_of_expired_messages_and_channels(1);
}