summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/event/ngx_event_pipe.c13
-rw-r--r--src/http/ngx_http_upstream.c15
2 files changed, 28 insertions, 0 deletions
diff --git a/src/event/ngx_event_pipe.c b/src/event/ngx_event_pipe.c
index be1b475bb..f54e07005 100644
--- a/src/event/ngx_event_pipe.c
+++ b/src/event/ngx_event_pipe.c
@@ -113,11 +113,24 @@ ngx_event_pipe_read_upstream(ngx_event_pipe_t *p)
}
#if (NGX_THREADS)
+
if (p->aio) {
ngx_log_debug0(NGX_LOG_DEBUG_EVENT, p->log, 0,
"pipe read upstream: aio");
return NGX_AGAIN;
}
+
+ if (p->writing) {
+ ngx_log_debug0(NGX_LOG_DEBUG_EVENT, p->log, 0,
+ "pipe read upstream: writing");
+
+ rc = ngx_event_pipe_write_chain_to_temp_file(p);
+
+ if (rc != NGX_OK) {
+ return rc;
+ }
+ }
+
#endif
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0,
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index 1386bdb95..168f6b48f 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -3744,9 +3744,24 @@ ngx_http_upstream_process_request(ngx_http_request_t *r,
p = u->pipe;
#if (NGX_THREADS)
+
+ if (p->writing && !p->aio) {
+
+ /*
+ * make sure to call ngx_event_pipe()
+ * if there is an incomplete aio write
+ */
+
+ if (ngx_event_pipe(p, 1) == NGX_ABORT) {
+ ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
+ return;
+ }
+ }
+
if (p->writing) {
return;
}
+
#endif
if (u->peer.connection) {