Mercurial > hg > nginx-quic
view src/os/unix/ngx_thread_cond.c @ 7623:72b792bb3885
HTTP/2: fixed socket leak with an incomplete HEADERS frame.
A connection could get stuck without timers if a client has partially sent
the HEADERS frame such that it was split on the individual header boundary.
In this case, it cannot be processed without the rest of the HEADERS frame.
The fix is to call ngx_http_v2_state_headers_save() in this case. Normally,
it would be called from the ngx_http_v2_state_header_block() handler on the
next iteration, when there is not enough data to continue processing. This
isn't the case if recv_buffer became empty and there's no more data to read.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 05 Feb 2020 16:29:23 +0300 |
parents | 022ea0d17177 |
children |
line wrap: on
line source
/* * Copyright (C) Igor Sysoev * Copyright (C) Nginx, Inc. */ #include <ngx_config.h> #include <ngx_core.h> ngx_int_t ngx_thread_cond_create(ngx_thread_cond_t *cond, ngx_log_t *log) { ngx_err_t err; err = pthread_cond_init(cond, NULL); if (err == 0) { return NGX_OK; } ngx_log_error(NGX_LOG_EMERG, log, err, "pthread_cond_init() failed"); return NGX_ERROR; } ngx_int_t ngx_thread_cond_destroy(ngx_thread_cond_t *cond, ngx_log_t *log) { ngx_err_t err; err = pthread_cond_destroy(cond); if (err == 0) { return NGX_OK; } ngx_log_error(NGX_LOG_EMERG, log, err, "pthread_cond_destroy() failed"); return NGX_ERROR; } ngx_int_t ngx_thread_cond_signal(ngx_thread_cond_t *cond, ngx_log_t *log) { ngx_err_t err; err = pthread_cond_signal(cond); if (err == 0) { return NGX_OK; } ngx_log_error(NGX_LOG_EMERG, log, err, "pthread_cond_signal() failed"); return NGX_ERROR; } ngx_int_t ngx_thread_cond_wait(ngx_thread_cond_t *cond, ngx_thread_mutex_t *mtx, ngx_log_t *log) { ngx_err_t err; err = pthread_cond_wait(cond, mtx); #if 0 ngx_time_update(); #endif if (err == 0) { return NGX_OK; } ngx_log_error(NGX_LOG_ALERT, log, err, "pthread_cond_wait() failed"); return NGX_ERROR; }