comparison src/http/ngx_http_request.c @ 346:55e496a8ece3

nginx-0.0.3-2004-06-06-23:49:18 import
author Igor Sysoev <igor@sysoev.ru>
date Sun, 06 Jun 2004 19:49:18 +0000
parents e366ba5db8f8
children 2e3cbc1bbe3c
comparison
equal deleted inserted replaced
345:fade4edd61f8 346:55e496a8ece3
88 rev->event_handler = ngx_http_init_request; 88 rev->event_handler = ngx_http_init_request;
89 89
90 /* STUB: epoll edge */ c->write->event_handler = ngx_http_empty_handler; 90 /* STUB: epoll edge */ c->write->event_handler = ngx_http_empty_handler;
91 91
92 if (rev->ready) { 92 if (rev->ready) {
93 /* deferred accept, aio, iocp */ 93 /* the deferred accept(), rtsig, aio, iocp */
94 94
95 if (ngx_accept_mutex) { 95 if (ngx_accept_mutex) {
96 if (ngx_mutex_lock(ngx_posted_events_mutex) == NGX_ERROR) { 96 if (ngx_mutex_lock(ngx_posted_events_mutex) == NGX_ERROR) {
97 ngx_http_close_connection(c); 97 ngx_http_close_connection(c);
98 return; 98 return;
1540 } 1540 }
1541 1541
1542 1542
1543 void ngx_http_close_request(ngx_http_request_t *r, int error) 1543 void ngx_http_close_request(ngx_http_request_t *r, int error)
1544 { 1544 {
1545 ngx_uint_t i; 1545 ngx_uint_t i;
1546 ngx_log_t *log; 1546 ngx_log_t *log;
1547 ngx_http_log_ctx_t *ctx; 1547 ngx_http_log_ctx_t *ctx;
1548 ngx_http_cleanup_t *cleanup; 1548 ngx_http_cleanup_t *cleanup;
1549 ngx_http_core_loc_conf_t *clcf;
1550 struct linger l;
1549 1551
1550 log = r->connection->log; 1552 log = r->connection->log;
1551 1553
1552 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, log, 0, "http close request"); 1554 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, log, 0, "http close request");
1553 1555
1608 ngx_close_file_n " deleted file \"%s\" failed", 1610 ngx_close_file_n " deleted file \"%s\" failed",
1609 r->request_body->temp_file->file.name.data); 1611 r->request_body->temp_file->file.name.data);
1610 } 1612 }
1611 } 1613 }
1612 1614
1615 if (r->connection->timedout) {
1616 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
1617
1618 if (clcf->reset_timedout_connection) {
1619 l.l_onoff = 1;
1620 l.l_linger = 0;
1621
1622 if (setsockopt(r->connection->fd, SOL_SOCKET, SO_LINGER,
1623 (const void *) &l, sizeof(struct linger)) == -1)
1624 {
1625 ngx_log_error(NGX_LOG_ALERT, log, ngx_socket_errno,
1626 "setsockopt(SO_LINGER) failed");
1627 }
1628 }
1629 }
1630
1613 /* ctx->url was allocated from r->pool */ 1631 /* ctx->url was allocated from r->pool */
1614 ctx = log->data; 1632 ctx = log->data;
1615 ctx->url = NULL; 1633 ctx->url = NULL;
1616 1634
1617 ngx_destroy_pool(r->pool); 1635 ngx_destroy_pool(r->pool);
1674 ctx = r->connection->log->data; 1692 ctx = r->connection->log->data;
1675 1693
1676 if (error == NGX_HTTP_REQUEST_TIME_OUT) { 1694 if (error == NGX_HTTP_REQUEST_TIME_OUT) {
1677 ngx_log_error(NGX_LOG_INFO, r->connection->log, NGX_ETIMEDOUT, 1695 ngx_log_error(NGX_LOG_INFO, r->connection->log, NGX_ETIMEDOUT,
1678 "client timed out"); 1696 "client timed out");
1697 r->connection->timedout = 1;
1679 ngx_http_close_request(r, error); 1698 ngx_http_close_request(r, error);
1680 ngx_http_close_connection(r->connection); 1699 ngx_http_close_connection(r->connection);
1681 return; 1700 return;
1682 } 1701 }
1683 1702