mirror of
https://github.com/nginx/nginx.git
synced 2024-12-20 14:13:33 -06:00
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
This commit is contained in:
parent
6d2a14aa90
commit
d90282d8ba
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_event.h>
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGINX_H_INCLUDED_
|
||||
#define _NGINX_H_INCLUDED_
|
||||
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_ARRAY_H_INCLUDED_
|
||||
#define _NGX_ARRAY_H_INCLUDED_
|
||||
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_BUF_H_INCLUDED_
|
||||
#define _NGX_BUF_H_INCLUDED_
|
||||
|
||||
@ -6,46 +12,9 @@
|
||||
#include <ngx_core.h>
|
||||
|
||||
|
||||
#if 0
|
||||
/* the buf type */
|
||||
typedef void * ngx_buf_tag_t;
|
||||
|
||||
/* the buf's content is in memory */
|
||||
#define NGX_HUNK_IN_MEMORY 0x0001
|
||||
/* the buf's content can be changed */
|
||||
#define NGX_HUNK_TEMP 0x0002
|
||||
/* the buf's content is in cache and can not be changed */
|
||||
#define NGX_HUNK_MEMORY 0x0004
|
||||
#define NGX_HUNK_MMAP 0x0008
|
||||
|
||||
/* the buf's content is recycled */
|
||||
#define NGX_HUNK_RECYCLED 0x0010
|
||||
|
||||
/* the buf's content is in a file */
|
||||
#define NGX_HUNK_FILE 0x0020
|
||||
|
||||
#define NGX_HUNK_STORAGE (NGX_HUNK_IN_MEMORY \
|
||||
|NGX_HUNK_TEMP|NGX_HUNK_MEMORY|NGX_HUNK_MMAP \
|
||||
|NGX_HUNK_RECYCLED|NGX_HUNK_FILE)
|
||||
|
||||
/* the buf flags */
|
||||
|
||||
/* in thread state flush means to write the buf completely before return */
|
||||
/* in event state flush means to start to write the buf */
|
||||
#define NGX_HUNK_FLUSH 0x0100
|
||||
|
||||
/* the last buf */
|
||||
#define NGX_HUNK_LAST 0x0200
|
||||
|
||||
|
||||
#define NGX_HUNK_PREREAD 0x2000
|
||||
#define NGX_HUNK_LAST_SHADOW 0x4000
|
||||
#define NGX_HUNK_TEMP_FILE 0x8000
|
||||
#endif
|
||||
|
||||
|
||||
typedef void * ngx_buf_tag_t;
|
||||
|
||||
typedef struct ngx_buf_s ngx_buf_t;
|
||||
typedef struct ngx_buf_s ngx_buf_t;
|
||||
|
||||
struct ngx_buf_s {
|
||||
u_char *pos;
|
||||
@ -61,17 +30,18 @@ struct ngx_buf_s {
|
||||
ngx_buf_t *shadow;
|
||||
|
||||
|
||||
/* the buf's content can be changed */
|
||||
/* the buf's content could be changed */
|
||||
unsigned temporary:1;
|
||||
|
||||
/*
|
||||
* the buf's content is in a memory cache or in a read only memory
|
||||
* and can not be changed
|
||||
* and must not be changed
|
||||
*/
|
||||
unsigned memory:1;
|
||||
|
||||
/* the buf's content is mmap()ed and can not be changed */
|
||||
/* the buf's content is mmap()ed and must not be changed */
|
||||
unsigned mmap:1;
|
||||
|
||||
unsigned recycled:1;
|
||||
unsigned in_file:1;
|
||||
unsigned flush:1;
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_HTTP_CONF_FILE_H_INCLUDED_
|
||||
#define _NGX_HTTP_CONF_FILE_H_INCLUDED_
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_CONFIG_H_INCLUDED_
|
||||
#define _NGX_CONFIG_H_INCLUDED_
|
||||
|
||||
@ -116,5 +122,10 @@ typedef long ngx_flag_t;
|
||||
#define INET_ADDRSTRLEN 16
|
||||
#endif
|
||||
|
||||
#define NGX_MAXHOSTNAMELEN 64
|
||||
/*
|
||||
#define NGX_MAXHOSTNAMELEN MAXHOSTNAMELEN
|
||||
*/
|
||||
|
||||
|
||||
#endif /* _NGX_CONFIG_H_INCLUDED_ */
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_event.h>
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_CONNECTION_H_INCLUDED_
|
||||
#define _NGX_CONNECTION_H_INCLUDED_
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_CORE_H_INCLUDED_
|
||||
#define _NGX_CORE_H_INCLUDED_
|
||||
|
||||
@ -70,11 +76,4 @@ typedef void (*ngx_event_handler_pt)(ngx_event_t *ev);
|
||||
#define CRLF "\x0d\x0a"
|
||||
|
||||
|
||||
|
||||
#define NGX_MAXHOSTNAMELEN 64
|
||||
/*
|
||||
#define NGX_MAXHOSTNAMELEN MAXHOSTNAMELEN
|
||||
*/
|
||||
|
||||
|
||||
#endif /* _NGX_CORE_H_INCLUDED_ */
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_CRC_H_INCLUDED_
|
||||
#define _NGX_CRC_H_INCLUDED_
|
||||
|
||||
@ -9,9 +15,10 @@ ngx_inline static uint32_t ngx_crc(char *data, size_t len)
|
||||
uint32_t sum;
|
||||
|
||||
for (sum = 0; len; len--) {
|
||||
|
||||
/*
|
||||
* gcc 2.95.2 x86 and icc 7.1.006 compile that operator
|
||||
* into the single rol opcode.
|
||||
* into the single "rol" opcode.
|
||||
* msvc 6.0sp2 compiles it into four opcodes.
|
||||
*/
|
||||
sum = sum >> 1 | sum << 31;
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_event.h>
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_CYCLE_H_INCLUDED_
|
||||
#define _NGX_CYCLE_H_INCLUDED_
|
||||
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_FILE_H_INCLUDED_
|
||||
#define _NGX_FILE_H_INCLUDED_
|
||||
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_garbage_collector.h>
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_GARBAGE_COLLECTOR_H_INCLUDED_
|
||||
#define _NGX_GARBAGE_COLLECTOR_H_INCLUDED_
|
||||
|
||||
|
@ -1,4 +1,10 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_INET_H_INCLUDED_
|
||||
#define _NGX_INET_H_INCLUDED_
|
||||
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_LIST_H_INCLUDED_
|
||||
#define _NGX_LIST_H_INCLUDED_
|
||||
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_LOG_H_INCLUDED_
|
||||
#define _NGX_LOG_H_INCLUDED_
|
||||
|
||||
@ -24,8 +30,8 @@
|
||||
#define NGX_LOG_DEBUG_IMAP 0x200
|
||||
|
||||
/*
|
||||
* after the adding a new debug level do not forget to update
|
||||
* debug_levels[] in src/core/ngx_log.c
|
||||
* do not forget to update debug_levels[] in src/core/ngx_log.c
|
||||
* after the adding a new debug level
|
||||
*/
|
||||
|
||||
#define NGX_LOG_DEBUG_FIRST NGX_LOG_DEBUG_CORE
|
||||
@ -34,50 +40,6 @@
|
||||
#define NGX_LOG_DEBUG_ALL 0x7ffffff0
|
||||
|
||||
|
||||
/*
|
||||
"[%time] [%level] %pid#%tid: %message:(%errno)%errstr, while %action"
|
||||
" %peer and while processing %context"
|
||||
|
||||
----
|
||||
message = "recv() failed";
|
||||
errno = 32;
|
||||
action = "reading request headers from client";
|
||||
peer = "192.168.1.1";
|
||||
context = "URL /"
|
||||
|
||||
"[2002/08/20 12:00:00] [error] 412#3: recv() failed (32: Broken pipe)"
|
||||
" while reading request headers from client 192.168.1.1"
|
||||
" and while processing URL /"
|
||||
|
||||
----
|
||||
message = "recv() failed";
|
||||
errno = 32;
|
||||
ngx_http_proxy_error_context_t:
|
||||
action = "reading headers from server %s for client %s and "
|
||||
"while processing %s"
|
||||
backend = "127.0.0.1";
|
||||
peer = "192.168.1.1";
|
||||
context = "URL /"
|
||||
|
||||
"[2002/08/20 12:00:00] [error] 412#3: recv() failed (32: Broken pipe)"
|
||||
" while reading headers from backend 127.0.0.1"
|
||||
" for client 192.168.1.1 and while processing URL /"
|
||||
|
||||
----
|
||||
"[alert] 412#3: ngx_alloc: malloc() 102400 bytes failed (12: Cannot "
|
||||
"allocate memory) while reading request headers from client 192.168.1.1"
|
||||
" and while processing URL /"
|
||||
|
||||
|
||||
OLD:
|
||||
"... while ", action = "reading client request headers"
|
||||
"... while reading client request headers"
|
||||
"... while ", action = "reading client request headers"
|
||||
context: pop3 user account
|
||||
"... while reading client command for 'john_doe'"
|
||||
*/
|
||||
|
||||
|
||||
typedef size_t (*ngx_log_handler_pt) (void *ctx, char *buf, size_t len);
|
||||
|
||||
|
||||
@ -88,7 +50,7 @@ struct ngx_log_s {
|
||||
ngx_log_handler_pt handler;
|
||||
};
|
||||
|
||||
#define MAX_ERROR_STR 2048
|
||||
#define MAX_ERROR_STR 2048
|
||||
|
||||
|
||||
/*********************************/
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_event.h>
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_PALLOC_H_INCLUDED_
|
||||
#define _NGX_PALLOC_H_INCLUDED_
|
||||
|
||||
@ -8,7 +14,7 @@
|
||||
|
||||
/*
|
||||
* NGX_MAX_ALLOC_FROM_POOL should be (ngx_page_size - 1), i.e. 4095 on x86.
|
||||
* On FreeBSD 5.x it allows to use zero copy send.
|
||||
* On FreeBSD 5.x it allows to use the zero copy sending.
|
||||
* On Windows NT it decreases a number of locked pages in a kernel.
|
||||
*/
|
||||
#define NGX_MAX_ALLOC_FROM_POOL (ngx_pagesize - 1)
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_PARSE_H_INCLUDED_
|
||||
#define _NGX_PARSE_H_INCLUDED_
|
||||
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_RADIX_TREE_H_INCLUDED_
|
||||
#define _NGX_RADIX_TREE_H_INCLUDED_
|
||||
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_RBTREE_H_INCLUDED_
|
||||
#define _NGX_RBTREE_H_INCLUDED_
|
||||
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_REGEX_H_INCLUDED_
|
||||
#define _NGX_REGEX_H_INCLUDED_
|
||||
|
||||
|
@ -1,8 +1,11 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
|
||||
void *ngx_slab_alloc(ngx_slab_pool_t *pool, size_t size)
|
||||
{
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_SLAB_H_INCLUDED_
|
||||
#define _NGX_SLAB_H_INCLUDED_
|
||||
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_STRING_H_INCLUDED_
|
||||
#define _NGX_STRING_H_INCLUDED_
|
||||
|
||||
@ -19,48 +25,47 @@ typedef struct {
|
||||
#if (WIN32)
|
||||
|
||||
#define ngx_strncasecmp(s1, s2, n) \
|
||||
strnicmp((const char *) s1, (const char *) s2, n)
|
||||
strnicmp((const char *) s1, (const char *) s2, n)
|
||||
#define ngx_strcasecmp(s1, s2) \
|
||||
stricmp((const char *) s1, (const char *) s2)
|
||||
stricmp((const char *) s1, (const char *) s2)
|
||||
|
||||
#define ngx_snprintf _snprintf
|
||||
#define ngx_vsnprintf _vsnprintf
|
||||
#define ngx_snprintf _snprintf
|
||||
#define ngx_vsnprintf _vsnprintf
|
||||
|
||||
#else
|
||||
|
||||
#define ngx_strncasecmp(s1, s2, n) \
|
||||
strncasecmp((const char *) s1, (const char *) s2, n)
|
||||
strncasecmp((const char *) s1, (const char *) s2, n)
|
||||
#define ngx_strcasecmp(s1, s2) \
|
||||
strcasecmp((const char *) s1, (const char *) s2)
|
||||
strcasecmp((const char *) s1, (const char *) s2)
|
||||
|
||||
#define ngx_snprintf snprintf
|
||||
#define ngx_vsnprintf vsnprintf
|
||||
#define ngx_snprintf snprintf
|
||||
#define ngx_vsnprintf vsnprintf
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#define ngx_strncmp(s1, s2, n) \
|
||||
strncmp((const char *) s1, (const char *) s2, n)
|
||||
strncmp((const char *) s1, (const char *) s2, n)
|
||||
|
||||
/* msvc and icc compile strcmp() to inline loop */
|
||||
#define ngx_strcmp(s1, s2) strcmp((const char *) s1, (const char *) s2)
|
||||
#define ngx_strcmp(s1, s2) strcmp((const char *) s1, (const char *) s2)
|
||||
|
||||
#define ngx_strstr(s1, s2) strstr((const char *) s1, (const char *) s2)
|
||||
#define ngx_strlen(s) strlen((const char *) s)
|
||||
#define ngx_strstr(s1, s2) strstr((const char *) s1, (const char *) s2)
|
||||
#define ngx_strlen(s) strlen((const char *) s)
|
||||
|
||||
/*
|
||||
* msvc and icc compile memset() to inline "rep stos"
|
||||
* while ZeroMemory and bzero are calls.
|
||||
*
|
||||
* icc can also inline mov's of a zeroed register for small blocks.
|
||||
* msvc and icc compile memset() to the inline "rep stos"
|
||||
* while ZeroMemory() and bzero() are the calls.
|
||||
* icc may also inline several mov's of a zeroed register for small blocks.
|
||||
*/
|
||||
#define ngx_memzero(buf, n) memset(buf, 0, n)
|
||||
|
||||
/* msvc and icc compile memcpy() to inline "rep movs" */
|
||||
/* msvc and icc compile memcpy() to the inline "rep movs" */
|
||||
#define ngx_memcpy(dst, src, n) memcpy(dst, src, n)
|
||||
#define ngx_cpymem(dst, src, n) ((u_char *) memcpy(dst, src, n)) + n
|
||||
|
||||
/* msvc and icc compile memcmp() to inline loop */
|
||||
/* msvc and icc compile memcmp() to the inline loop */
|
||||
#define ngx_memcmp memcmp
|
||||
|
||||
u_char *ngx_cpystrn(u_char *dst, u_char *src, size_t n);
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_TABLE_H_INCLUDED_
|
||||
#define _NGX_TABLE_H_INCLUDED_
|
||||
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
|
||||
@ -12,7 +17,7 @@ static ngx_int_t ngx_gmtoff;
|
||||
|
||||
|
||||
/*
|
||||
* In the threaded mode only one thread updates cached time and strings
|
||||
* In the threaded mode only one thread updates the cached time and strings
|
||||
* and these operations are protected by the mutex. The reading of the cached
|
||||
* time and strings is not protected by the mutex. To avoid the race
|
||||
* conditions for non-atomic values we use the NGX_TIME_SLOTS slots to store
|
||||
@ -290,6 +295,7 @@ void ngx_gmtime(time_t t, ngx_tm_t *tp)
|
||||
mon += 2;
|
||||
|
||||
if (yday >= 306) {
|
||||
|
||||
/*
|
||||
* there is no "yday" in Win32 SYSTEMTIME
|
||||
*
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_TIMES_H_INCLUDED_
|
||||
#define _NGX_TIMES_H_INCLUDED_
|
||||
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_event.h>
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_AIO_MODULE_H_INCLUDED_
|
||||
#define _NGX_AIO_MODULE_H_INCLUDED_
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev, http://sysoev.ru/en/
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev, http://sysoev.ru/en/
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev, http://sysoev.ru/en/
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_IOCP_MODULE_H_INCLUDED_
|
||||
#define _NGX_IOCP_MODULE_H_INCLUDED_
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev, http://sysoev.ru/en/
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_KQUEUE_MODULE_H_INCLUDED_
|
||||
#define _NGX_KQUEUE_MODULE_H_INCLUDED_
|
||||
|
||||
|
@ -1,41 +0,0 @@
|
||||
|
||||
|
||||
event = WSACreateEvent(void);
|
||||
WSAEventSelect(s, event, FD_ACCEPT);
|
||||
|
||||
|
||||
int ngx_overlapped_process_events(ngx_log_t *log)
|
||||
{
|
||||
if (acceptex)
|
||||
n = SleepEx(timer, 1);
|
||||
else
|
||||
n = WSAWaitForMultipleEvents(nevents, events, 0, timer, 1);
|
||||
|
||||
if (n == WSA_WAIT_TIMEOUT)
|
||||
close some event;
|
||||
|
||||
if (n == WSA_IO_COMPLETION)
|
||||
again
|
||||
|
||||
/* try it with AcceptEx() on NT to detect connected sockets */
|
||||
if (!acceptex) {
|
||||
WSAEnumNetworkEvents(
|
||||
sockets[n - WSA_WAIT_EVENT_0],
|
||||
events[n - WSA_WAIT_EVENT_0],
|
||||
net_events);
|
||||
|
||||
if (net_events.lNetworkEvents & FD_ACCEPT) {
|
||||
if (net_events.iErrorCode[FD_ACCEPT_BIT] != 0)
|
||||
accept error
|
||||
again
|
||||
|
||||
ngx_event_accept(); OR post AcceptEx();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CALLBACK overlapped_completion_procedure(DWORD error, DWORD nbytes,
|
||||
LPWSAOVERLAPPED overlapped, DWORD flags)
|
||||
{
|
||||
run event handler
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev, http://sysoev.ru/en/
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev, http://sysoev.ru/en/
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev, http://sysoev.ru/en/
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_event.h>
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_EVENT_H_INCLUDED_
|
||||
#define _NGX_EVENT_H_INCLUDED_
|
||||
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_event.h>
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_event.h>
|
||||
|
@ -1,113 +0,0 @@
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_errno.h>
|
||||
#include <ngx_log.h>
|
||||
#include <ngx_recv.h>
|
||||
#include <ngx_connection.h>
|
||||
#include <ngx_event.h>
|
||||
|
||||
#if (HAVE_KQUEUE)
|
||||
#include <ngx_kqueue_module.h>
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
The data is ready - 3 syscalls:
|
||||
aio_read(), aio_error(), aio_return()
|
||||
The data is not ready - 4 (kqueue) or 5 syscalls:
|
||||
aio_read(), aio_error(), notifiction,
|
||||
aio_error(), aio_return()
|
||||
aio_cancel(), aio_error()
|
||||
*/
|
||||
|
||||
ssize_t ngx_event_aio_read(ngx_connection_t *c, char *buf, size_t size)
|
||||
{
|
||||
int rc, first, canceled;
|
||||
ngx_event_t *ev;
|
||||
|
||||
ev = c->read;
|
||||
|
||||
canceled = 0;
|
||||
|
||||
if (ev->timedout) {
|
||||
ngx_set_socket_errno(NGX_ETIMEDOUT);
|
||||
ngx_log_error(NGX_LOG_ERR, ev->log, 0, "aio_read() timed out");
|
||||
|
||||
rc = aio_cancel(c->fd, &ev->aiocb);
|
||||
if (rc == -1) {
|
||||
ngx_log_error(NGX_LOG_CRIT, ev->log, ngx_errno,
|
||||
"aio_cancel() failed");
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
ngx_log_debug(ev->log, "aio_cancel: %d" _ rc);
|
||||
|
||||
canceled = 1;
|
||||
|
||||
ev->ready = 1;
|
||||
}
|
||||
|
||||
first = 0;
|
||||
|
||||
if (!ev->ready) {
|
||||
ngx_memzero(&ev->aiocb, sizeof(struct aiocb));
|
||||
|
||||
ev->aiocb.aio_fildes = c->fd;
|
||||
ev->aiocb.aio_buf = buf;
|
||||
ev->aiocb.aio_nbytes = size;
|
||||
|
||||
#if (HAVE_KQUEUE)
|
||||
ev->aiocb.aio_sigevent.sigev_notify_kqueue = kq;
|
||||
ev->aiocb.aio_sigevent.sigev_notify = SIGEV_KEVENT;
|
||||
ev->aiocb.aio_sigevent.sigev_value.sigval_ptr = ev;
|
||||
#endif
|
||||
|
||||
if (aio_read(&ev->aiocb) == -1) {
|
||||
ngx_log_error(NGX_LOG_CRIT, ev->log, ngx_errno,
|
||||
"aio_read() failed");
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
ngx_log_debug(ev->log, "aio_read: OK");
|
||||
|
||||
ev->active = 1;
|
||||
first = 1;
|
||||
}
|
||||
|
||||
ev->ready = 0;
|
||||
|
||||
rc = aio_error(&ev->aiocb);
|
||||
if (rc == -1) {
|
||||
ngx_log_error(NGX_LOG_CRIT, ev->log, ngx_errno, "aio_error() failed");
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
if (rc != 0) {
|
||||
if (rc == NGX_EINPROGRESS) {
|
||||
if (!first) {
|
||||
ngx_log_error(NGX_LOG_CRIT, ev->log, rc,
|
||||
"aio_read() still in progress");
|
||||
}
|
||||
return NGX_AGAIN;
|
||||
}
|
||||
|
||||
if (rc == NGX_ECANCELED && canceled) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
ngx_log_error(NGX_LOG_CRIT, ev->log, rc, "aio_read() failed");
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
rc = aio_return(&ev->aiocb);
|
||||
if (rc == -1) {
|
||||
ngx_log_error(NGX_LOG_CRIT, ev->log, ngx_errno, "aio_return() failed");
|
||||
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
ngx_log_debug(ev->log, "aio_read: %d" _ rc);
|
||||
|
||||
return rc;
|
||||
}
|
@ -1,116 +0,0 @@
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_errno.h>
|
||||
#include <ngx_log.h>
|
||||
#include <ngx_recv.h>
|
||||
#include <ngx_connection.h>
|
||||
#include <ngx_event.h>
|
||||
|
||||
#if (HAVE_KQUEUE)
|
||||
#include <ngx_kqueue_module.h>
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
The data is ready - 3 syscalls:
|
||||
aio_write(), aio_error(), aio_return()
|
||||
The data is not ready - 4 (kqueue) or 5 syscalls:
|
||||
aio_write(), aio_error(), notifiction,
|
||||
aio_error(), aio_return()
|
||||
aio_cancel(), aio_error()
|
||||
*/
|
||||
|
||||
ssize_t ngx_event_aio_write(ngx_connection_t *c, char *buf, size_t size)
|
||||
{
|
||||
int rc, first, canceled;
|
||||
ngx_event_t *ev;
|
||||
|
||||
ev = c->write;
|
||||
|
||||
canceled = 0;
|
||||
|
||||
ngx_log_debug(ev->log, "aio: ev->ready: %d" _ ev->ready);
|
||||
ngx_log_debug(ev->log, "aio: aiocb: %08x" _ &ev->aiocb);
|
||||
|
||||
if (ev->timedout) {
|
||||
ngx_set_socket_errno(NGX_ETIMEDOUT);
|
||||
ngx_log_error(NGX_LOG_ERR, ev->log, 0, "aio_write() timed out");
|
||||
|
||||
rc = aio_cancel(c->fd, &ev->aiocb);
|
||||
if (rc == -1) {
|
||||
ngx_log_error(NGX_LOG_CRIT, ev->log, ngx_errno,
|
||||
"aio_cancel() failed");
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
ngx_log_debug(ev->log, "aio_cancel: %d" _ rc);
|
||||
|
||||
canceled = 1;
|
||||
|
||||
ev->ready = 1;
|
||||
}
|
||||
|
||||
first = 0;
|
||||
|
||||
if (!ev->ready) {
|
||||
ngx_memzero(&ev->aiocb, sizeof(struct aiocb));
|
||||
|
||||
ev->aiocb.aio_fildes = c->fd;
|
||||
ev->aiocb.aio_buf = buf;
|
||||
ev->aiocb.aio_nbytes = size;
|
||||
|
||||
#if (HAVE_KQUEUE)
|
||||
ev->aiocb.aio_sigevent.sigev_notify_kqueue = kq;
|
||||
ev->aiocb.aio_sigevent.sigev_notify = SIGEV_KEVENT;
|
||||
ev->aiocb.aio_sigevent.sigev_value.sigval_ptr = ev;
|
||||
#endif
|
||||
|
||||
if (aio_write(&ev->aiocb) == -1) {
|
||||
ngx_log_error(NGX_LOG_CRIT, ev->log, ngx_errno,
|
||||
"aio_write() failed");
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
ngx_log_debug(ev->log, "aio_write: OK");
|
||||
|
||||
ev->active = 1;
|
||||
first = 1;
|
||||
}
|
||||
|
||||
ev->ready = 0;
|
||||
|
||||
rc = aio_error(&ev->aiocb);
|
||||
if (rc == -1) {
|
||||
ngx_log_error(NGX_LOG_CRIT, ev->log, ngx_errno, "aio_error() failed");
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
if (rc != 0) {
|
||||
if (rc == NGX_EINPROGRESS) {
|
||||
if (!first) {
|
||||
ngx_log_error(NGX_LOG_CRIT, ev->log, rc,
|
||||
"aio_write() still in progress");
|
||||
}
|
||||
return NGX_AGAIN;
|
||||
}
|
||||
|
||||
if (rc == NGX_ECANCELED && canceled) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
ngx_log_error(NGX_LOG_CRIT, ev->log, rc, "aio_write() failed");
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
rc = aio_return(&ev->aiocb);
|
||||
if (rc == -1) {
|
||||
ngx_log_error(NGX_LOG_CRIT, ev->log, ngx_errno, "aio_return() failed");
|
||||
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
ngx_log_debug(ev->log, "aio_write: %d" _ rc);
|
||||
|
||||
return rc;
|
||||
}
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_event.h>
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_EVENT_BUSY_LOCK_H_INCLUDED_
|
||||
#define _NGX_EVENT_BUSY_LOCK_H_INCLUDED_
|
||||
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_event.h>
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_EVENT_CONNECT_H_INCLUDED_
|
||||
#define _NGX_EVENT_CONNECT_H_INCLUDED_
|
||||
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_event.h>
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_event.h>
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_event.h>
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_EVENT_OPENSSL_H_INCLUDED_
|
||||
#define _NGX_EVENT_OPENSSL_H_INCLUDED_
|
||||
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_event.h>
|
||||
@ -656,8 +661,12 @@ ngx_inline static void ngx_event_pipe_remove_shadow_links(ngx_buf_t *buf)
|
||||
#if 0
|
||||
b->type &= ~(NGX_HUNK_TEMP|NGX_HUNK_IN_MEMORY|NGX_HUNK_RECYCLED);
|
||||
#endif
|
||||
b->temporary = 0;
|
||||
b->recycled = 0;
|
||||
b->in_file = 0;
|
||||
b->temp_file = 0;
|
||||
b->flush = 0;
|
||||
b->zerocopy_busy = 0;
|
||||
b->last_shadow = 0;
|
||||
|
||||
b->shadow = NULL;
|
||||
b = next;
|
||||
}
|
||||
@ -669,9 +678,10 @@ ngx_inline static void ngx_event_pipe_remove_shadow_links(ngx_buf_t *buf)
|
||||
|NGX_HUNK_LAST_SHADOW);
|
||||
#endif
|
||||
|
||||
b->temporary = 0;
|
||||
b->recycled = 0;
|
||||
b->last_shadow = 0;
|
||||
b->in_file = 0;
|
||||
b->temp_file = 0;
|
||||
b->flush = 0;
|
||||
b->zerocopy_busy = 0;
|
||||
|
||||
b->shadow = NULL;
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_EVENT_PIPE_H_INCLUDED_
|
||||
#define _NGX_EVENT_PIPE_H_INCLUDED_
|
||||
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_event.h>
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_EVENT_POSTED_H_INCLUDED_
|
||||
#define _NGX_EVENT_POSTED_H_INCLUDED_
|
||||
|
||||
|
@ -1,147 +0,0 @@
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_errno.h>
|
||||
#include <ngx_log.h>
|
||||
#include <ngx_recv.h>
|
||||
#include <ngx_connection.h>
|
||||
|
||||
ssize_t ngx_event_recv_core(ngx_connection_t *c, char *buf, size_t size)
|
||||
{
|
||||
ssize_t n;
|
||||
ngx_err_t err;
|
||||
ngx_event_t *ev;
|
||||
|
||||
ev = c->read;
|
||||
|
||||
/* DEBUG */
|
||||
#if (HAVE_KQUEUE)
|
||||
if (ngx_event_flags & NGX_HAVE_KQUEUE_EVENT) {
|
||||
ngx_log_debug(c->log, "ngx_event_recv: eof:%d, avail:%d, err:%d" _
|
||||
ev->eof _ ev->available _ ev->error);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (USE_KQUEUE)
|
||||
|
||||
if (ev->eof && ev->available == 0) {
|
||||
|
||||
if (ev->error == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ngx_set_socket_errno(ev->error);
|
||||
err = ev->error;
|
||||
n = -1;
|
||||
|
||||
} else {
|
||||
n = ngx_recv(c->fd, buf, size, 0);
|
||||
|
||||
if (n == -1) {
|
||||
err = ngx_socket_errno;
|
||||
}
|
||||
}
|
||||
|
||||
if (n == -1) {
|
||||
ev->ready = 0;
|
||||
|
||||
if (err == NGX_ECONNRESET && ev->ignore_econnreset) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (err == NGX_EAGAIN) {
|
||||
ngx_log_error(NGX_LOG_INFO, c->log, err, "recv() returned EAGAIN");
|
||||
return NGX_AGAIN;
|
||||
}
|
||||
|
||||
ngx_log_error(NGX_LOG_ERR, c->log, err, "recv() failed");
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
ev->available -= n;
|
||||
if (ev->available == 0) {
|
||||
ev->ready = 0;
|
||||
}
|
||||
|
||||
return n;
|
||||
|
||||
#elif (HAVE_KQUEUE)
|
||||
|
||||
if ((ngx_event_flags & NGX_HAVE_KQUEUE_EVENT)
|
||||
&& ev->eof && ev->available == 0) {
|
||||
|
||||
if (ev->error == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ngx_set_socket_errno(ev->error);
|
||||
err = ev->error;
|
||||
n = -1;
|
||||
|
||||
} else {
|
||||
n = ngx_recv(c->fd, buf, size, 0);
|
||||
ngx_log_debug(c->log, "ngx_event_recv: read:%d:%d" _ n _ size);
|
||||
|
||||
if (n == -1) {
|
||||
err = ngx_socket_errno;
|
||||
}
|
||||
}
|
||||
|
||||
if (n == -1) {
|
||||
ev->ready = 0;
|
||||
|
||||
if (err == NGX_ECONNRESET && ev->ignore_econnreset) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (err == NGX_EAGAIN) {
|
||||
ngx_log_error(NGX_LOG_INFO, c->log, err, "recv() returned EAGAIN");
|
||||
return NGX_AGAIN;
|
||||
}
|
||||
|
||||
ngx_log_error(NGX_LOG_ERR, c->log, err, "recv() failed");
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
if (ngx_event_flags & NGX_HAVE_KQUEUE_EVENT) {
|
||||
ev->available -= n;
|
||||
if (ev->available == 0) {
|
||||
ev->ready = 0;
|
||||
}
|
||||
|
||||
} else if ((size_t) n < size) {
|
||||
ev->ready = 0;
|
||||
}
|
||||
|
||||
return n;
|
||||
|
||||
#else /* not kqueue */
|
||||
|
||||
n = ngx_recv(c->fd, buf, size, 0);
|
||||
|
||||
if (n == -1) {
|
||||
err = ngx_socket_errno;
|
||||
|
||||
ev->ready = 0;
|
||||
|
||||
if (err == NGX_ECONNRESET && ev->ignore_econnreset) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (err == NGX_EAGAIN) {
|
||||
ngx_log_error(NGX_LOG_INFO, c->log, err, "recv() returned EAGAIN");
|
||||
return NGX_AGAIN;
|
||||
}
|
||||
|
||||
ngx_log_error(NGX_LOG_ERR, c->log, err, "recv() failed");
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
if ((size_t) n < size) {
|
||||
ev->ready = 0;
|
||||
}
|
||||
|
||||
return n;
|
||||
|
||||
#endif
|
||||
}
|
@ -1,129 +0,0 @@
|
||||
|
||||
volitile int ngx_last_posted_event;
|
||||
|
||||
|
||||
typedef struct {
|
||||
ngx_tid_t tid;
|
||||
ngx_cv_t cv;
|
||||
} ngx_thread_data_t;
|
||||
|
||||
static ngx_thread_data_t *threead_data;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
|
||||
err = ngx_thread_cond_wait(ngx_thread_data_cv, ngx_thread_data_mutex);
|
||||
|
||||
tid = ngx_thread_self();
|
||||
|
||||
for (i = 0; i < thread_data_n; i++) {
|
||||
if (thread_data[i].tid == tid) {
|
||||
cv = thread_data[i].cv;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == thread_data_n) {
|
||||
error
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
for ( ;; ) {
|
||||
|
||||
err = ngx_thread_cond_wait(cv, ngx_posted_events_mutex);
|
||||
if (err) {
|
||||
ngx_log_error(NGX_ALERT, log, err,
|
||||
ngx_thread_cond_wait_n " failed, thread is exiting");
|
||||
return;
|
||||
}
|
||||
|
||||
for ( ;; ) {
|
||||
ev = NULL;
|
||||
|
||||
for (i = ngx_last_posted_event; i > 0; i--) {
|
||||
ev = ngx_posted_events[i];
|
||||
|
||||
if (ev == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
err = ngx_thread_mutex_trylock(ev->mutex);
|
||||
|
||||
if (err == 0) {
|
||||
ngx_posted_events[i] = NULL;
|
||||
|
||||
while (ngx_posted_events[ngx_last_posted_event] == NULL) {
|
||||
ngx_last_posted_event--;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (err == NGX_EBUSY) {
|
||||
ev = NULL;
|
||||
continue;
|
||||
}
|
||||
|
||||
ngx_log_error(NGX_ALERT, log, err,
|
||||
ngx_thread_mutex_unlock_n " failed,
|
||||
thread is exiting");
|
||||
|
||||
ngx_worker_thread_error();
|
||||
return;
|
||||
}
|
||||
|
||||
err = ngx_thread_mutex_unlock(ngx_posted_events_mutex);
|
||||
if (err) {
|
||||
ngx_log_error(NGX_ALERT, log, err,
|
||||
ngx_thread_mutex_unlock_n
|
||||
" failed, thread exiting");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ev == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
ngx_event_handle_event(ev);
|
||||
|
||||
err = ngx_thread_mutex_unlock(ev->mutex);
|
||||
if (err) {
|
||||
ngx_log_error(NGX_ALERT, log, err,
|
||||
ngx_thread_mutex_unlock_n
|
||||
" failed, thread exiting");
|
||||
|
||||
ngx_worker_thread_error();
|
||||
return;
|
||||
}
|
||||
|
||||
err = ngx_thread_mutex_lock(ngx_posted_events_mutex);
|
||||
if (err) {
|
||||
ngx_log_error(NGX_ALERT, log, err,
|
||||
ngx_thread_mutex_lock_n
|
||||
" failed, thread exiting");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (restart) {
|
||||
ngx_log_error(NGX_INFO, log, 0, "thread is exiting");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ngx_worker_thread_error()
|
||||
{
|
||||
ngx_err_t err;
|
||||
|
||||
err = ngx_thread_mutex_unlock(ngx_posted_events_mutex);
|
||||
if (err) {
|
||||
ngx_log_error(NGX_ALERT, log, err,
|
||||
ngx_thread_mutex_unlock_n
|
||||
" failed, thread exiting");
|
||||
}
|
||||
}
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_event.h>
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_EVENT_TIMER_H_INCLUDED_
|
||||
#define _NGX_EVENT_TIMER_H_INCLUDED_
|
||||
|
||||
|
@ -1,97 +0,0 @@
|
||||
|
||||
#include <ngx_config.h>
|
||||
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_errno.h>
|
||||
#include <ngx_log.h>
|
||||
#include <ngx_connection.h>
|
||||
#include <ngx_event.h>
|
||||
|
||||
|
||||
ssize_t ngx_event_wsarecv(ngx_connection_t *c, char *buf, size_t size)
|
||||
{
|
||||
int rc;
|
||||
u_int flags;
|
||||
size_t bytes;
|
||||
ngx_err_t err;
|
||||
WSABUF wsabuf[1];
|
||||
ngx_event_t *ev;
|
||||
LPWSAOVERLAPPED_COMPLETION_ROUTINE handler;
|
||||
|
||||
ev = c->read;
|
||||
|
||||
/* DEBUG */ bytes = 0;
|
||||
|
||||
if (ev->timedout) {
|
||||
ngx_set_socket_errno(NGX_ETIMEDOUT);
|
||||
ngx_log_error(NGX_LOG_ERR, ev->log, 0, "WSARecv() timed out");
|
||||
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
if (ev->ready) {
|
||||
ev->ready = 0;
|
||||
|
||||
#if (HAVE_IOCP) /* iocp */
|
||||
|
||||
if (ngx_event_flags & NGX_HAVE_IOCP_EVENT) {
|
||||
if (ev->ovlp.error) {
|
||||
ngx_log_error(NGX_LOG_ERR, c->log, ev->ovlp.error,
|
||||
"WSARecv() failed");
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
return ev->available;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (WSAGetOverlappedResult(c->fd, (LPWSAOVERLAPPED) &ev->ovlp,
|
||||
&bytes, 0, NULL) == 0) {
|
||||
err = ngx_socket_errno;
|
||||
ngx_log_error(NGX_LOG_CRIT, ev->log, err,
|
||||
"WSARecv() or WSAGetOverlappedResult() failed");
|
||||
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
ngx_memzero(&ev->ovlp, sizeof(WSAOVERLAPPED));
|
||||
wsabuf[0].buf = buf;
|
||||
wsabuf[0].len = size;
|
||||
flags = 0;
|
||||
|
||||
#if 0
|
||||
handler = ev->handler;
|
||||
#else
|
||||
handler = NULL;
|
||||
#endif
|
||||
|
||||
rc = WSARecv(c->fd, wsabuf, 1, &bytes, &flags,
|
||||
(LPWSAOVERLAPPED) &ev->ovlp, handler);
|
||||
|
||||
ngx_log_debug(ev->log, "WSARecv: %d:%d" _ rc _ bytes);
|
||||
|
||||
if (rc == -1) {
|
||||
err = ngx_socket_errno;
|
||||
if (err == WSA_IO_PENDING) {
|
||||
return NGX_AGAIN;
|
||||
|
||||
} else {
|
||||
ngx_log_error(NGX_LOG_CRIT, ev->log, err, "WSARecv() failed");
|
||||
return NGX_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
#if (HAVE_IOCP) /* iocp */
|
||||
|
||||
if (ngx_event_flags & NGX_HAVE_IOCP_EVENT) {
|
||||
return NGX_AGAIN;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return bytes;
|
||||
}
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_http.h>
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_http.h>
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_http.h>
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_http.h>
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_http.h>
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_http.h>
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_http.h>
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_http.h>
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_http.h>
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_http.h>
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_http.h>
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_HTTP_SSL_H_INCLUDED_
|
||||
#define _NGX_HTTP_SSL_H_INCLUDED_
|
||||
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_http.h>
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_http.h>
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_http.h>
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_http.h>
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_http.h>
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _NGX_HTTP_PROXY_HANDLER_H_INCLUDED_
|
||||
#define _NGX_HTTP_PROXY_HANDLER_H_INCLUDED_
|
||||
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_http.h>
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_http.h>
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Igor Sysoev
|
||||
*/
|
||||
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_event.h>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user