void ngx_http_push_subscriber_cleanup(ngx_http_push_subscriber_cleanup_t *data) {
  if(data->subscriber!=NULL) { //still queued up
    ngx_http_push_subscriber_t* sb = data->subscriber;
    ngx_http_push_subscriber_del_timer(sb);
    ngx_queue_remove(&data->subscriber->queue);
    ngx_pfree(ngx_http_push_pool, data->subscriber); //was there an error? oh whatever.
  }
  if (data->rchain != NULL) {
    ngx_pfree(data->rpool, data->rchain->buf);
    ngx_pfree(data->rpool, data->rchain);
    data->rchain=NULL;
  }
  if(data->buf_use_count != NULL && --(*data->buf_use_count) <= 0) {
    ngx_buf_t                      *buf;
    ngx_pfree(ngx_http_push_pool, data->buf_use_count);
    buf=data->buf;
    if(buf->file) {
      ngx_close_file(buf->file->fd);
    }
    ngx_pfree(ngx_http_push_pool, buf);
  }
  
  if(data->channel!=NULL) { //we're expected to decrement the subscriber count
    ngx_http_push_store->lock();
    data->channel->subscribers--;
    ngx_http_push_store->unlock();
  }
}
static void ngx_http_push_subscriber_cleanup(ngx_http_push_subscriber_cleanup_t *data) {
	if(data->subscriber!=NULL) { //still queued up
		ngx_http_push_subscriber_t* sb = data->subscriber;

		ngx_http_push_subscriber_del_timer(sb);
		ngx_queue_remove(&data->subscriber->queue);
		ngx_pfree(ngx_http_push_pool, data->subscriber); //was there an error? oh whatever.
	}
	if(data->channel!=NULL) { //we're expected to decrement the subscriber count
		ngx_shmtx_lock(&ngx_http_push_shpool->mutex);
		data->channel->subscribers--;
		ngx_shmtx_unlock(&ngx_http_push_shpool->mutex);
	}
}
static void ngx_http_push_subscriber_clear_ctx(ngx_http_push_subscriber_t *sb) {
	ngx_http_push_subscriber_del_timer(sb);
	sb->clndata->subscriber = NULL;
	sb->clndata->channel = NULL;
}