@@ -116,6 +116,8 @@ ngx_http_push_stream_delete_channels_data(ngx_http_push_stream_shm_data_t *data)
116
116
117
117
ngx_http_push_stream_loc_conf_t * cf = ngx_http_get_module_loc_conf (subscriber -> request , ngx_http_push_stream_module );
118
118
ngx_http_push_stream_send_event (mcf , ngx_cycle -> log , subscription -> channel , & NGX_HTTP_PUSH_STREAM_EVENT_TYPE_CLIENT_UNSUBSCRIBED , subscriber -> request -> pool , subscriber -> request , cf -> client_unsubscribed_request_url );
119
+ if (!channel -> subscribers ) ngx_http_push_stream_send_event (mcf , ngx_cycle -> log , subscription -> channel , NULL , subscriber -> request -> pool , subscriber -> request , cf -> channel_destroyed_request_url );
120
+ if (!worker -> subscribers ) ngx_http_push_stream_send_event (mcf , ngx_cycle -> log , subscription -> channel , NULL , subscriber -> request -> pool , subscriber -> request , cf -> all_worker_clients_unsubscribed_request_url );
119
121
120
122
if (subscriber -> longpolling ) {
121
123
ngx_http_push_stream_add_polling_headers (subscriber -> request , ngx_time (), 0 , subscriber -> request -> pool );
@@ -472,7 +474,7 @@ ngx_http_push_stream_send_event(ngx_http_push_stream_main_conf_t *mcf, ngx_log_t
472
474
ngx_http_push_stream_shm_data_t * data = mcf -> shm_data ;
473
475
ngx_pool_t * temp_pool = received_temp_pool ;
474
476
475
- if ((mcf -> events_channel_id .len > 0 ) && !channel -> for_events ) {
477
+ if ((mcf -> events_channel_id .len > 0 ) && !channel -> for_events && event_type ) {
476
478
if ((temp_pool == NULL ) && ((temp_pool = ngx_create_pool (4096 , log )) == NULL )) {
477
479
return NGX_ERROR ;
478
480
}
@@ -489,9 +491,11 @@ ngx_http_push_stream_send_event(ngx_http_push_stream_main_conf_t *mcf, ngx_log_t
489
491
}
490
492
}
491
493
492
- if ((r != NULL ) && (uri != NULL )) {
494
+ if (r && uri ) {
495
+ ngx_str_t vv_uri ;
496
+ ngx_http_push_stream_complex_value (r , uri , & vv_uri );
493
497
ngx_http_request_t * sr ;
494
- if (ngx_http_subrequest (r , & uri -> value , & r -> args , & sr , NULL , NGX_HTTP_SUBREQUEST_BACKGROUND ) != NGX_OK ) {
498
+ if (ngx_http_subrequest (r , & vv_uri , & r -> args , & sr , NULL , NGX_HTTP_SUBREQUEST_BACKGROUND ) != NGX_OK ) {
495
499
ngx_log_error (NGX_LOG_ERR , r -> connection -> log , 0 , "ngx_http_subrequest != NGX_OK" );
496
500
}
497
501
}
@@ -1589,6 +1593,8 @@ ngx_http_push_stream_worker_subscriber_cleanup(ngx_http_push_stream_subscriber_t
1589
1593
ngx_shmtx_unlock (subscription -> channel -> mutex );
1590
1594
1591
1595
ngx_http_push_stream_send_event (mcf , ngx_cycle -> log , subscription -> channel , & NGX_HTTP_PUSH_STREAM_EVENT_TYPE_CLIENT_UNSUBSCRIBED , worker_subscriber -> request -> pool , worker_subscriber -> request , cf -> client_unsubscribed_request_url );
1596
+ if (!subscription -> channel -> subscribers ) ngx_http_push_stream_send_event (mcf , ngx_cycle -> log , subscription -> channel , NULL , worker_subscriber -> request -> pool , worker_subscriber -> request , cf -> channel_destroyed_request_url );
1597
+ if (!subscription -> channel_worker_sentinel -> subscribers ) ngx_http_push_stream_send_event (mcf , ngx_cycle -> log , subscription -> channel , NULL , worker_subscriber -> request -> pool , worker_subscriber -> request , cf -> all_worker_clients_unsubscribed_request_url );
1592
1598
}
1593
1599
1594
1600
ngx_shmtx_lock (& shpool -> mutex );
0 commit comments