コード例 #1
0
ファイル: http_server.c プロジェクト: liexusong/NXWEB
static void nxweb_http_server_connection_do_finalize(nxweb_http_server_connection* conn, int good) {
  //nxe_loop* loop=conn->sock.fs.data_is.super.loop;
  nxweb_http_server_connection_finalize_subrequests(conn, good);
  if (conn->worker_complete.pub) nxe_unsubscribe(conn->worker_complete.pub, &conn->worker_complete);
  conn->hsp.cls->finalize(&conn->hsp);
  if (conn->sock.cls) conn->sock.cls->finalize((nxd_socket*)&conn->sock, good);
  nxp_free(conn->tdata->free_conn_pool, conn);
  //if (!__sync_sub_and_fetch(&num_connections, 1)) nxweb_log_info("all connections closed");
}
コード例 #2
0
ファイル: ssi_filter.c プロジェクト: liexusong/NXWEB
static void ssi_finalize(nxweb_filter* filter, nxweb_http_server_connection* conn, nxweb_http_request* req, nxweb_http_response* resp, nxweb_filter_data* fdata) {
  ssi_filter_data* sfdata=(ssi_filter_data*)fdata;
  if (sfdata->ssib.data_in.pair) nxe_disconnect_streams(sfdata->ssib.data_in.pair, &sfdata->ssib.data_in);
  if (sfdata->input_fd) {
    close(sfdata->input_fd);
    sfdata->input_fd=0;
  }
  if (sfdata->ssib.nxb) {
    nxb_empty(sfdata->ssib.nxb);
    nxp_free(conn->hsp.nxb_pool, sfdata->ssib.nxb);
  }
}
コード例 #3
0
ファイル: nxd_http_client_proto.c プロジェクト: X4/nxweb_hg
void nxd_http_client_proto_rearm(nxd_http_client_proto* hcp) {
  assert(hcp->nxb);
  nxb_empty(hcp->nxb);
  nxp_free(hcp->nxb_pool, hcp->nxb);
  hcp->nxb=0;
  memset(&hcp->_req, 0, sizeof(hcp->_req));
  hcp->_req.nxb=hcp->nxb;
  hcp->_req.host=0;
  hcp->resp.nxb=hcp->nxb;
  while (hcp->events_pub.sub) nxe_unsubscribe(&hcp->events_pub, hcp->events_pub.sub);
  if (hcp->req_body_in.pair) nxe_disconnect_streams(hcp->req_body_in.pair, &hcp->req_body_in);
  if (hcp->resp_body_out.pair) nxe_disconnect_streams(&hcp->resp_body_out, hcp->resp_body_out.pair);
  nxe_ostream_unset_ready(&hcp->req_body_in);
  nxe_istream_unset_ready(&hcp->resp_body_out);
  nxe_ostream_unset_ready(&hcp->data_in);
  nxe_istream_unset_ready(&hcp->data_out);
}
コード例 #4
0
ファイル: nxd_http_client_proto.c プロジェクト: X4/nxweb_hg
void nxd_http_client_proto_finalize(nxd_http_client_proto* hcp) {
  nxe_loop* loop=hcp->data_in.super.loop;
  nxe_unset_timer(loop, NXWEB_TIMER_KEEP_ALIVE, &hcp->timer_keep_alive);
  nxe_unset_timer(loop, NXWEB_TIMER_READ, &hcp->timer_read);
  nxe_unset_timer(loop, NXWEB_TIMER_WRITE, &hcp->timer_write);
  nxe_unset_timer(loop, NXWEB_TIMER_100CONTINUE, &hcp->timer_100_continue);
  if (hcp->data_error.pub) nxe_unsubscribe(hcp->data_error.pub, &hcp->data_error);
  while (hcp->events_pub.sub) nxe_unsubscribe(&hcp->events_pub, hcp->events_pub.sub);
  if (hcp->data_in.pair) nxe_disconnect_streams(hcp->data_in.pair, &hcp->data_in);
  if (hcp->data_out.pair) nxe_disconnect_streams(&hcp->data_out, hcp->data_out.pair);
  if (hcp->req_body_in.pair) nxe_disconnect_streams(hcp->req_body_in.pair, &hcp->req_body_in);
  if (hcp->resp_body_out.pair) nxe_disconnect_streams(&hcp->resp_body_out, hcp->resp_body_out.pair);
  if (hcp->nxb) {
    nxb_empty(hcp->nxb);
    nxp_free(hcp->nxb_pool, hcp->nxb);
    hcp->nxb=0;
  }
}
コード例 #5
0
ファイル: http_proxy.c プロジェクト: liexusong/NXWEB
static void nxweb_http_proxy_request_finalize(nxd_http_server_proto* hsp, void* req_data) {

  nxweb_log_debug("nxweb_http_proxy_request_finalize");

  nxweb_http_proxy_request_data* rdata=req_data;
  nxweb_http_server_connection* conn=rdata->conn;
  nxe_loop* loop=conn->tdata->loop;
  nxe_unset_timer(loop, NXWEB_TIMER_BACKEND, &rdata->timer_backend);
  if (rdata->rb_resp.data_in.pair) nxe_disconnect_streams(rdata->rb_resp.data_in.pair, &rdata->rb_resp.data_in);
  if (rdata->rb_resp.data_out.pair) nxe_disconnect_streams(&rdata->rb_resp.data_out, rdata->rb_resp.data_out.pair);
  if (rdata->rb_req.data_in.pair) nxe_disconnect_streams(rdata->rb_req.data_in.pair, &rdata->rb_req.data_in);
  if (rdata->rb_req.data_out.pair) nxe_disconnect_streams(&rdata->rb_req.data_out, rdata->rb_req.data_out.pair);
  if (rdata->proxy_events_sub.pub) nxe_unsubscribe(rdata->proxy_events_sub.pub, &rdata->proxy_events_sub);
  if (rdata->hpx) {
    nxd_http_proxy_pool_return(rdata->hpx, rdata->proxy_request_error);
    rdata->hpx=0;
  }
  if (rdata->rbuf) {
    if (rdata->rbuf) nxp_free(conn->tdata->free_rbuf_pool, rdata->rbuf);
    rdata->rbuf=0;
  }
}