nginx 학습 10 ngxcycle_t 、ngx_connection_t 와 ngxlistening_t
http://blog.csdn.net/xiaoliangsky/article/details/398310351ngx_listening_t
코어 / ngxconnection. h 중
struct ngx_listening_s {
ngx_socket_t fd;//
struct sockaddr *sockaddr;// sockaddr
socklen_t socklen; /*sockaddr size of sockaddr */
size_t addr_text_max_len;// ip addr_text
ngx_str_t addr_text;// ip
// 。types SOCK_STREAM , tcp
int type;
//TCP backlog , tcp
int backlog;
int rcvbuf;//
int sndbuf;//
/* handler of accepted connection */
ngx_connection_handler_pt handler;// tcp
// HTTP mail ,
void *servers; /* array of ngx_http_in_addr_t, for example */
ngx_log_t log;//
ngx_log_t *logp;//
size_t pool_size;// tcp , pool_size。
/* should be here because of the AcceptEx() preread */
size_t post_accept_buffer_size;
/* should be here because of the deferred accept */
ngx_msec_t post_accept_timeout;//~ ,
// ngx_listening_t ,
ngx_listening_t *previous;
ngx_connection_t *connection;// ngx_connection_t
unsigned open:1;// 1 , 0
unsigned remain:1;// 1 , 0
unsigned ignore:1;// 1 ngx_listening_t , 0
unsigned bound:1; /* already bound */
unsigned inherited:1; /* inherited from previous process */
unsigned nonblocking_accept:1;
unsigned listen:1;// 1
unsigned nonblocking:1;
unsigned shared:1; /* shared between threads or processes */
unsigned addr_ntop:1;// 1
#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
unsigned ipv6only:2;
#endif
#if (NGX_HAVE_DEFERRED_ACCEPT)
unsigned deferred_accept:1;
unsigned delete_deferred:1;
unsigned add_deferred:1;
#ifdef SO_ACCEPTFILTER
char *accept_filter;
#endif
#endif
#if (NGX_HAVE_SETFIB)
int setfib;
#endif
};
2ngx_connction_t
코어 / ngxconnection. h 중
struct ngx_connection_s {
// ,data next 。 ,HTTP ,data ngx_http_request_t
void *data;
ngx_event_t *read;//
ngx_event_t *write;//
ngx_socket_t fd;//
ngx_recv_pt recv;//
ngx_send_pt send;//
ngx_recv_chain_pt recv_chain;//
ngx_send_chain_pt send_chain;//
// ngx_listening_t , listening
ngx_listening_t *listening;
off_t sent;//
ngx_log_t *log;//
/* 。 accept , , 。 listening pool_size */
ngx_pool_t *pool;
struct sockaddr *sockaddr;// sockaddr
socklen_t socklen;//sockaddr
ngx_str_t addr_text;// IP
#if (NGX_SSL)
ngx_ssl_connection_t *ssl;
#endif
// sockaddr , listening sockaddr
struct sockaddr *local_sockaddr;
ngx_buf_t *buffer;// 、 ,buffer ,
/* ngx_cycle_t reuseable_connection_queue , */
ngx_queue_t queue;
/* 。ngx_connection_t , ,number 1*/
ngx_atomic_uint_t number;
ngx_uint_t requests;//
// 。
unsigned buffered:8;
// , 3 , 0~7, 5 , ngx_connection_log_error_e 。
unsigned log_error:3; /* ngx_connection_log_error_e */
unsigned single_connection:1;// 1 , 0
unsigned unexpected_eof:1;// 1
unsigned timedout:1;// 1
unsigned error:1;// 1
unsigned destroyed:1;// 1
unsigned idle:1;// 1 , keepalive
unsigned reusable:1;// 1 , queue
unsigned close:1;// 1
unsigned sendfile:1;// 1
/* 1 , 。 ngx_handle_write_event lowat */
unsigned sndlowat:1;
unsigned tcp_nodelay:2; /* ngx_connection_tcp_nodelay_e */
unsigned tcp_nopush:2; /* ngx_connection_tcp_nopush_e */
#if (NGX_HAVE_IOCP)
unsigned accept_context_updated:1;
#endif
#if (NGX_HAVE_AIO_SENDFILE)
unsigned aio_sendfile:1;
ngx_buf_t *busy_sendfile;
#endif
#if (NGX_THREADS)
ngx_atomic_t lock;
#endif
};
3ngx_cycle_t
코어 / ngxcycle. h 중
struct ngx_cycle_s {
/* , , , */
void ****conf_ctx;
ngx_pool_t *pool;//
/* ngx_log_t , log ngx_init_cycle , , , log , 。 ngx_init_cycle , nginx.conf , , log */
ngx_log_t *log;
/* ngx_init_cycle , new_log log */
ngx_log_t new_log;
//fiels ngx_connection_t ,files_n , files
ngx_connection_t **files;
// , free_connection_n
ngx_connection_t *free_connections;
//
ngx_uint_t free_connection_n;
// , ngx_connection_t
ngx_queue_t reusable_connections_queue;
// ngx_listening_t
ngx_array_t listening;
// Nginx , , , Nginx 。
ngx_array_t pathes;
// Nginx (ngx_open_file_t ) 。
ngx_list_t open_files;
// ngx_shm_zone_t, 。
ngx_list_t shared_memory;
// , connections
ngx_uint_t connection_n;
// files ngx_connection_t
ngx_uint_t files_n;
// ,
ngx_connection_t *connections;
// ,connection_n
ngx_event_t *read_events;
// ,connection_n
ngx_event_t *write_events;
/* ngx_cycle_t ngx_cycle_t , ngx_init_cycle , , ngx_cycle_t , ngx_init_cycle , ngx_cycle_t , old_clcle ngx_clcle_t 。*/
ngx_cycle_t *old_cycle;
//
ngx_str_t conf_file;
//Nginx , -g
ngx_str_t conf_param;
//Nginx
ngx_str_t conf_prefix;
//Nginx
ngx_str_t prefix;
//
ngx_str_t lock_file;
// gethostname
ngx_str_t hostname;
};
4ngx_conf_t 코어 / ngxconf_file.h
struct ngx_conf_s {
char *name;//
ngx_array_t *args;//
ngx_cycle_t *cycle;// , ngx_cycle.h
ngx_pool_t *pool;//
ngx_pool_t *temp_pool;// ,
ngx_conf_file_t *conf_file;//ngx_conf_file_t
ngx_log_t *log;//
void *ctx;//
ngx_uint_t module_type;//
ngx_uint_t cmd_type;//
ngx_conf_handler_pt handler;//
char *handler_conf;//
};
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
간단! Certbot을 사용하여 웹 사이트를 SSL(HTTPS)화하는 방법초보자가 인프라 주위를 정돈하는 것은 매우 어렵습니다. 이번은 사이트를 간단하게 SSL화(HTTP에서 HTTPS통신)로 변경하는 방법을 소개합니다! 이번에는 소프트웨어 시스템 Nginx CentOS7 의 환경에서 S...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.