Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/store/memory/memstore.c
Original file line number Diff line number Diff line change
Expand Up @@ -1394,7 +1394,7 @@ ngx_int_t nchan_memstore_publish_generic(memstore_channel_head_t *head, nchan_ms

static ngx_int_t chanhead_messages_delete(memstore_channel_head_t *ch);

static ngx_int_t empty_callback(){
static ngx_int_t empty_callback(ngx_int_t status, void *ptr1, void *ptr2){
return NGX_OK;
}

Expand Down
4 changes: 2 additions & 2 deletions src/subscribers/eventsource.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ static ngx_int_t es_respond_message(subscriber_t *sub, nchan_msg_t *msg) {
return nchan_output_msg_filter(fsub->sub.request, msg, first_link);
}

static void empty_handler(void) {}
static void empty_cleanup_handler(void *data) {}

static ngx_int_t es_respond_status(subscriber_t *sub, ngx_int_t status_code, const ngx_str_t *status_line, ngx_chain_t *status_body){

Expand Down Expand Up @@ -275,7 +275,7 @@ static ngx_int_t es_respond_status(subscriber_t *sub, ngx_int_t status_code, con
nchan_output_filter(fsub->sub.request, &bc.chain);

if((status_code >=400 && status_code <599) || status_code == NGX_HTTP_NOT_MODIFIED) {
fsub->data.cln->handler = (ngx_http_cleanup_pt )empty_handler;
fsub->data.cln->handler = empty_cleanup_handler;
fsub->sub.request->keepalive=0;
sub->request->headers_out.status = status_code;
fsub->data.finalize_request=1;
Expand Down
17 changes: 9 additions & 8 deletions src/subscribers/longpoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ ngx_int_t memstore_slot(void);

static const subscriber_t new_longpoll_sub;

static void empty_handler() { }
static void empty_subscriber_handler(subscriber_t *sub, void *data) { }
static void empty_cleanup_handler(void *data) { }

static void sudden_abort_handler(subscriber_t *sub) {
if(sub->request && sub->status != DEAD) {
Expand Down Expand Up @@ -56,10 +57,10 @@ subscriber_t *longpoll_subscriber_create(ngx_http_request_t *r, nchan_msg_id_t *

nchan_subscriber_init_timeout_timer(&fsub->sub, &fsub->data.timeout_ev);

fsub->data.enqueue_callback = empty_handler;
fsub->data.enqueue_callback = empty_subscriber_handler;
fsub->data.enqueue_callback_data = NULL;

fsub->data.dequeue_callback = empty_handler;
fsub->data.dequeue_callback = empty_subscriber_handler;
fsub->data.dequeue_callback_data = NULL;

fsub->data.already_responded = 0;
Expand Down Expand Up @@ -296,7 +297,7 @@ static ngx_int_t longpoll_respond_message(subscriber_t *self, nchan_msg_t *msg)
}
if(!cf->longpoll_multimsg) {
//disable abort handler
fsub->data.cln->handler = empty_handler;
fsub->data.cln->handler = empty_cleanup_handler;

assert(fsub->data.already_responded != 1);
fsub->data.already_responded = 1;
Expand Down Expand Up @@ -344,7 +345,7 @@ static ngx_int_t longpoll_multipart_respond(full_subscriber_t *fsub) {
nchan_longpoll_multimsg_t *first, *cur;

//disable abort handler
fsub->data.cln->handler = empty_handler;
fsub->data.cln->handler = empty_cleanup_handler;

first = fsub->data.multimsg_first;

Expand Down Expand Up @@ -457,7 +458,7 @@ static ngx_int_t longpoll_respond_status(subscriber_t *self, ngx_int_t status_co
nchan_set_msgid_http_response_headers(r, NULL, &self->last_msgid);

//disable abort handler
fsub->data.cln->handler = empty_handler;
fsub->data.cln->handler = empty_cleanup_handler;

nchan_respond_status(r, status_code, status_line, status_body, 0);

Expand All @@ -470,7 +471,7 @@ ngx_int_t subscriber_respond_unqueued_status(full_subscriber_t *fsub, ngx_int_t
nchan_loc_conf_t *cf = fsub->sub.cf;
nchan_request_ctx_t *ctx;

fsub->data.cln->handler = (ngx_http_cleanup_pt )empty_handler;
fsub->data.cln->handler = empty_cleanup_handler;
fsub->data.finalize_request = 0;
fsub->sub.status = DEAD;
fsub->sub.fn->dequeue(&fsub->sub);
Expand All @@ -483,7 +484,7 @@ ngx_int_t subscriber_respond_unqueued_status(full_subscriber_t *fsub, ngx_int_t

void subscriber_maybe_dequeue_after_status_response(full_subscriber_t *fsub, ngx_int_t status_code) {
if((status_code >=400 && status_code < 600) || status_code == NGX_HTTP_NOT_MODIFIED) {
fsub->data.cln->handler = (ngx_http_cleanup_pt )empty_handler;
fsub->data.cln->handler = empty_cleanup_handler;
fsub->sub.request->keepalive=0;
fsub->data.finalize_request=1;
fsub->sub.request->headers_out.status = status_code;
Expand Down
2 changes: 1 addition & 1 deletion src/subscribers/memstore_ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct sub_data_s {
ngx_event_t timeout_ev;
}; //sub_data_t

static ngx_int_t empty_callback(){
static ngx_int_t empty_callback(ngx_int_t status, void *ptr1, void *ptr2){
return NGX_OK;
}

Expand Down
9 changes: 5 additions & 4 deletions src/subscribers/websocket.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ struct full_subscriber_s {
unsigned awaiting_destruction:1;
};// full_subscriber_t

static void empty_handler() { }
static void empty_subscriber_handler(subscriber_t *sub, void *data) { }
static void empty_cleanup_handler(void *data) { }

static ngx_int_t websocket_send_frame(full_subscriber_t *fsub, const u_char opcode, off_t len, ngx_chain_t *chain);
static void set_buf_to_str(ngx_buf_t *buf, const ngx_str_t *str);
Expand Down Expand Up @@ -279,7 +280,7 @@ static ngx_int_t websocket_finalize_request(full_subscriber_t *fsub) {
ngx_http_request_t *r = sub->request;

if(fsub->cln) {
fsub->cln->handler = (ngx_http_cleanup_pt )empty_handler;
fsub->cln->handler = empty_cleanup_handler;
}

if(sub->cf->unsubscribe_request_url && sub->enqueued) {
Expand Down Expand Up @@ -745,10 +746,10 @@ subscriber_t *websocket_subscriber_create(ngx_http_request_t *r, nchan_msg_id_t

ngx_memzero(&fsub->deflate, sizeof(fsub->deflate));

fsub->enqueue_callback = empty_handler;
fsub->enqueue_callback = empty_subscriber_handler;
fsub->enqueue_callback_data = NULL;

fsub->dequeue_callback = empty_handler;
fsub->dequeue_callback = empty_subscriber_handler;
fsub->dequeue_callback_data = NULL;
fsub->awaiting_destruction = 0;

Expand Down