comparison src/http/ngx_http_spdy_filter_module.c @ 5493:916cb6d28f6a

SPDY: fixed possible request hang. Processing events from upstream connection can result in sending queued frames from other streams. In this case such streams were not added to handling queue and properly handled. A global per connection flag was replaced by a per stream flag that indicates currently sending stream while all other streams can be added to handling queue.
author Valentin Bartenev <vbart@nginx.com>
date Thu, 26 Dec 2013 17:03:16 +0400
parents 86b563036d5a
children 27f9d5f68c1c
comparison
equal deleted inserted replaced
5492:5c52ff68f380 5493:916cb6d28f6a
793 793
794 794
795 static ngx_inline ngx_int_t 795 static ngx_inline ngx_int_t
796 ngx_http_spdy_filter_send(ngx_connection_t *fc, ngx_http_spdy_stream_t *stream) 796 ngx_http_spdy_filter_send(ngx_connection_t *fc, ngx_http_spdy_stream_t *stream)
797 { 797 {
798 stream->blocked = 1;
799
798 if (ngx_http_spdy_send_output_queue(stream->connection) == NGX_ERROR) { 800 if (ngx_http_spdy_send_output_queue(stream->connection) == NGX_ERROR) {
799 fc->error = 1; 801 fc->error = 1;
800 return NGX_ERROR; 802 return NGX_ERROR;
801 } 803 }
804
805 stream->blocked = 0;
802 806
803 if (stream->waiting) { 807 if (stream->waiting) {
804 fc->buffered |= NGX_SPDY_WRITE_BUFFERED; 808 fc->buffered |= NGX_SPDY_WRITE_BUFFERED;
805 fc->write->delayed = 1; 809 fc->write->delayed = 1;
806 return NGX_AGAIN; 810 return NGX_AGAIN;
944 948
945 fc = stream->request->connection; 949 fc = stream->request->connection;
946 950
947 fc->write->delayed = 0; 951 fc->write->delayed = 0;
948 952
949 if (stream->handled) { 953 if (stream->handled || stream->blocked) {
950 return; 954 return;
951 } 955 }
952 956
953 if (sc->blocked == 2) { 957 stream->handled = 1;
954 stream->handled = 1; 958
955 959 stream->next = sc->last_stream;
956 stream->next = sc->last_stream; 960 sc->last_stream = stream;
957 sc->last_stream = stream;
958 }
959 } 961 }
960 962
961 963
962 static void 964 static void
963 ngx_http_spdy_filter_cleanup(void *data) 965 ngx_http_spdy_filter_cleanup(void *data)