Ngx_event_pipe_s structure in Nginx notes

Source: Internet
Author: User
: This article mainly introduces the ngx_event_pipe_s struct in the notes "understanding Nginx". if you are interested in the PHP Tutorial, refer to it. Ngx_event_pipe_s

Typedefstruct ngx_event_pipe_s ngx_event_pipe_t; // handle the callback function prototype typedef ngx_int_t (* struct) (ngx_event_pipe_t * p, ngx_buf_t * buf) that receives the upstream package body ); // typedef ngx_int_t (* ngx_event_pipe_output_filter_pt) (void * data, ngx_chain_t * chain), the prototype of the callback function that sends a response to the downstream ); struct ngx_event_pipe_s {// connection between Nginx and upstream server ngx_connection_t * upstream; // connection between Nginx and downstream client ngx_connection_t * downstream;/* directly receives the buffer chain from the upstream server Table, which stores unprocessed data. This linked list is in reverse order, and the received response is inserted at the head of the linked list */ngx_chain_t * free_raw_bufs; // indicates the received upstream response buffer, the data is ngx_chain_t * in processed by input_filter; // points to the received buffer ngx_chain_t ** last_in; // stores the buffer list to be sent to the client. When the temporary file is successfully written, the buffer in is added to ngx_chain_t * out; // The buffer ngx_chain_t * free waiting for release; // indicates the last time the ngx_http_output_filter function was called to send a response, the ngx_chain_t * busy;/** the input filter I. e. that moves HTTP/1.1 chunks * from the raw bufs to an incoming chain * // process the received data from the upstream server ngx_event_pipe_input_filter_pt input_filter; // the parameter used for input_filter, generally, it is the address void * input_ctx of ngx_http_request_t; // The ngx_event_pipe _ function that sends a response to the downstream _ Output_filter_pt output_filter; // The output_filter parameter, pointing to callback * output_ctx; // 1: indicates the response unsigned read: 1; // 1: enable file cache unsigned cacheable: 1; // 1: when receiving upstream response, only one ngx_buf_t buffer unsigned single_buf: 1 can be received at a time; // 1: once the upstream package body is no longer received, the buffer unsigned free_bufs: 1 will be released as much as possible; // 1: indicates that the interaction between Nginx and upstream has ended unsigned upstream_done: 1; // 1: an error occurred while connecting Nginx to the upstream server. unsigned upstream_error: 1; // 1: The connection to the upstream server has been disabled. unsigned upstream_eo F: 1;/* 1: indicates temporarily blocking the process of reading upstream responses. In this case, the ngx_event_pipe_write_to_downstream function is called to send data in the buffer zone to the downstream to free up the buffer space. then, the ngx_event_pipe_read_upstream function is called to read upstream information */unsigned upstream_blocked: 1: the interaction with downstream has ended. unsigned downstream_done: 1; // 1: The connection to downstream has an error: unsigned downstream_error: 1; // 1: reusing temporary files. It is the unsigned cyclic_temp_file: 1; // allocated buffer data ngx_int_t allocated; // records the size of the memory buffer that receives upstream responses, bufs. size indicates the size of each memory buffer, bufs. num indicates that there can be a maximum of num buffer ngx_bufs_t bufs; // It is used to set and compare the tag flag of the ngx_buf_t struct in the buffer linked list ngx_buf_tag_t tag; /* maximum length of the response to be sent in the busy buffer. when busy_size is reached, you must wait for the busy buffer to send enough data to continue sending out and in content */ssize_t busy_size; // the length of the upstream response package has been received off_t read_length; off_t length; // The maximum length of the temporary file off_t max_temp_file_size; // indicates the maximum data length ssize_t temp_file_write_size when a file is written; // The timeout value for reading upstream responses ngx_msec_t read_timeout; // The timeout value for sending downstream responses ngx_msec_t send_timeout; // when a downstream response is sent, the send_lowat "water level" ssize_t send_lowat set in the TCP connection; // connection pool ngx_pool_t * pool; // log ngx_log_t * log; // indicates that the response package ngx_chain_t * preread_bufs has been read during the receiving of the upstream server response header; // indicates that the response header is received, the length of the response package has been read to size_t preread_size; // used to cache the file ngx_buf_t * buf_to_file; size_t limit_rate; time_t start_sec; // the temporary file ngx_temp_file_t * temp_file; // number of used ngx_buf_t buffers/* STUB */int num ;};

Copyright: Pain is just in your mind.

The above introduces the ngx_event_pipe_s structure in the notes of "understanding Nginx", including some content. I hope it will be helpful to anyone interested in the PHP Tutorial.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.