Mercurial > hg > nginx
comparison src/http/ngx_http_spdy.c @ 5403:7e062646da6f
SPDY: fixed connection leak while waiting for request headers.
If an error occurs in a SPDY connection, the c->error flag is set on every fake
request connection, and its read or write event handler is called, in order to
finalize it. But while waiting for request headers, it was a no-op since the
read event handler had been set to ngx_http_empty_handler().
author | Valentin Bartenev <vbart@nginx.com> |
---|---|
date | Tue, 01 Oct 2013 00:04:00 +0400 |
parents | 4d0c70541784 |
children | db85dacfa013 |
comparison
equal
deleted
inserted
replaced
5402:4d0c70541784 | 5403:7e062646da6f |
---|---|
143 | 143 |
144 static ngx_int_t ngx_http_spdy_construct_request_line(ngx_http_request_t *r); | 144 static ngx_int_t ngx_http_spdy_construct_request_line(ngx_http_request_t *r); |
145 static void ngx_http_spdy_run_request(ngx_http_request_t *r); | 145 static void ngx_http_spdy_run_request(ngx_http_request_t *r); |
146 static ngx_int_t ngx_http_spdy_init_request_body(ngx_http_request_t *r); | 146 static ngx_int_t ngx_http_spdy_init_request_body(ngx_http_request_t *r); |
147 | 147 |
148 static void ngx_http_spdy_close_stream_handler(ngx_event_t *ev); | |
149 | |
148 static void ngx_http_spdy_handle_connection_handler(ngx_event_t *rev); | 150 static void ngx_http_spdy_handle_connection_handler(ngx_event_t *rev); |
149 static void ngx_http_spdy_keepalive_handler(ngx_event_t *rev); | 151 static void ngx_http_spdy_keepalive_handler(ngx_event_t *rev); |
150 static void ngx_http_spdy_finalize_connection(ngx_http_spdy_connection_t *sc, | 152 static void ngx_http_spdy_finalize_connection(ngx_http_spdy_connection_t *sc, |
151 ngx_int_t rc); | 153 ngx_int_t rc); |
152 | 154 |
1823 | 1825 |
1824 ngx_memzero(rev, sizeof(ngx_event_t)); | 1826 ngx_memzero(rev, sizeof(ngx_event_t)); |
1825 | 1827 |
1826 rev->data = fc; | 1828 rev->data = fc; |
1827 rev->ready = 1; | 1829 rev->ready = 1; |
1828 rev->handler = ngx_http_empty_handler; | 1830 rev->handler = ngx_http_spdy_close_stream_handler; |
1829 rev->log = log; | 1831 rev->log = log; |
1830 | 1832 |
1831 ngx_memcpy(wev, rev, sizeof(ngx_event_t)); | 1833 ngx_memcpy(wev, rev, sizeof(ngx_event_t)); |
1832 | 1834 |
1833 wev->write = 1; | 1835 wev->write = 1; |
2613 | 2615 |
2614 return NGX_AGAIN; | 2616 return NGX_AGAIN; |
2615 } | 2617 } |
2616 | 2618 |
2617 | 2619 |
2620 static void | |
2621 ngx_http_spdy_close_stream_handler(ngx_event_t *ev) | |
2622 { | |
2623 ngx_connection_t *fc; | |
2624 ngx_http_request_t *r; | |
2625 | |
2626 fc = ev->data; | |
2627 r = fc->data; | |
2628 | |
2629 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
2630 "spdy close stream handler"); | |
2631 | |
2632 ngx_http_spdy_close_stream(r->spdy_stream, 0); | |
2633 } | |
2634 | |
2635 | |
2618 void | 2636 void |
2619 ngx_http_spdy_close_stream(ngx_http_spdy_stream_t *stream, ngx_int_t rc) | 2637 ngx_http_spdy_close_stream(ngx_http_spdy_stream_t *stream, ngx_int_t rc) |
2620 { | 2638 { |
2621 ngx_event_t *ev; | 2639 ngx_event_t *ev; |
2622 ngx_connection_t *fc; | 2640 ngx_connection_t *fc; |