Mercurial > hg > nginx
comparison src/http/ngx_http_upstream.c @ 8942:5c86189a1c1b quic
Merged with the default branch.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Fri, 24 Dec 2021 15:53:59 +0300 |
parents | 33226ac61076 a7a77549265e |
children | 8d0753760546 |
comparison
equal
deleted
inserted
replaced
8941:0433e69f5425 | 8942:5c86189a1c1b |
---|---|
3865 static ngx_int_t | 3865 static ngx_int_t |
3866 ngx_http_upstream_thread_handler(ngx_thread_task_t *task, ngx_file_t *file) | 3866 ngx_http_upstream_thread_handler(ngx_thread_task_t *task, ngx_file_t *file) |
3867 { | 3867 { |
3868 ngx_str_t name; | 3868 ngx_str_t name; |
3869 ngx_event_pipe_t *p; | 3869 ngx_event_pipe_t *p; |
3870 ngx_connection_t *c; | |
3870 ngx_thread_pool_t *tp; | 3871 ngx_thread_pool_t *tp; |
3871 ngx_http_request_t *r; | 3872 ngx_http_request_t *r; |
3872 ngx_http_core_loc_conf_t *clcf; | 3873 ngx_http_core_loc_conf_t *clcf; |
3873 | 3874 |
3874 r = file->thread_ctx; | 3875 r = file->thread_ctx; |
3875 p = r->upstream->pipe; | 3876 p = r->upstream->pipe; |
3877 | |
3878 if (r->aio) { | |
3879 /* | |
3880 * tolerate sendfile() calls if another operation is already | |
3881 * running; this can happen due to subrequests, multiple calls | |
3882 * of the next body filter from a filter, or in HTTP/2 due to | |
3883 * a write event on the main connection | |
3884 */ | |
3885 | |
3886 c = r->connection; | |
3887 | |
3888 #if (NGX_HTTP_V2) | |
3889 if (r->stream) { | |
3890 c = r->stream->connection->connection; | |
3891 } | |
3892 #endif | |
3893 | |
3894 if (task == c->sendfile_task) { | |
3895 return NGX_OK; | |
3896 } | |
3897 } | |
3876 | 3898 |
3877 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | 3899 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
3878 tp = clcf->thread_pool; | 3900 tp = clcf->thread_pool; |
3879 | 3901 |
3880 if (tp == NULL) { | 3902 if (tp == NULL) { |
3922 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, | 3944 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, |
3923 "http upstream thread: \"%V?%V\"", &r->uri, &r->args); | 3945 "http upstream thread: \"%V?%V\"", &r->uri, &r->args); |
3924 | 3946 |
3925 r->main->blocked--; | 3947 r->main->blocked--; |
3926 r->aio = 0; | 3948 r->aio = 0; |
3949 | |
3950 #if (NGX_HTTP_V2) | |
3951 | |
3952 if (r->stream) { | |
3953 /* | |
3954 * for HTTP/2, update write event to make sure processing will | |
3955 * reach the main connection to handle sendfile() in threads | |
3956 */ | |
3957 | |
3958 c->write->ready = 1; | |
3959 c->write->active = 0; | |
3960 } | |
3961 | |
3962 #endif | |
3927 | 3963 |
3928 if (r->done) { | 3964 if (r->done) { |
3929 /* | 3965 /* |
3930 * trigger connection event handler if the subrequest was | 3966 * trigger connection event handler if the subrequest was |
3931 * already finalized; this can happen if the handler is used | 3967 * already finalized; this can happen if the handler is used |