Changeset 1515
- Timestamp:
- 01/14/2007 08:21:26 AM (21 months ago)
- Location:
- trunk/src
- Files:
-
- 5 modified
-
mod_proxy_core.c (modified) (13 diffs)
-
mod_proxy_core.h (modified) (1 diff)
-
mod_proxy_core_backlog.c (modified) (1 diff)
-
mod_proxy_core_pool.c (modified) (1 diff)
-
mod_proxy_core_pool.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/mod_proxy_core.c
r1512 r1515 25 25 #define CONFIG_PROXY_CORE_PROTOCOL "proxy-core.protocol" 26 26 #define CONFIG_PROXY_CORE_DEBUG "proxy-core.debug" 27 #define CONFIG_PROXY_CORE_MAX_KEEP_ALIVE "proxy-core.max-keep-alive-requests" 27 28 #define CONFIG_PROXY_CORE_BACKENDS "proxy-core.backends" 28 29 #define CONFIG_PROXY_CORE_REWRITE_REQUEST "proxy-core.rewrite-request" … … 229 230 { CONFIG_PROXY_CORE_MAX_POOL_SIZE, NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 8 */ 230 231 { CONFIG_PROXY_CORE_CHECK_LOCAL, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 9 */ 232 { CONFIG_PROXY_CORE_MAX_KEEP_ALIVE, NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 10 */ 231 233 { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET } 232 234 }; … … 252 254 s->request_rewrites = proxy_rewrites_init(); 253 255 s->check_local = 0; 256 s->max_keep_alive_requests = 0; 254 257 255 258 cv[0].destination = p->backends_arr; … … 261 264 cv[8].destination = &(s->max_pool_size); 262 265 cv[9].destination = &(s->check_local); 266 cv[10].destination = &(s->max_keep_alive_requests); 263 267 264 268 buffer_reset(p->balance_buf); … … 908 912 switch (sess->proxy_con->state) { 909 913 case PROXY_CONNECTION_STATE_CONNECTED: 914 sess->proxy_con->request_count++; 915 if (p->conf.debug) TRACE("request_count=%d", sess->proxy_con->request_count); 916 if (sess->proxy_con->request_count >= p->conf.max_keep_alive_requests) { 917 sess->is_closing = 1; 918 } 910 919 /* 911 920 * Set the connection to idling if: … … 932 941 case PROXY_CONNECTION_STATE_CLOSED: 933 942 proxy_remove_backend_connection(srv, sess); 934 /* return so we don't wakeup a backlog connection. */935 return HANDLER_GO_ON;936 943 case PROXY_CONNECTION_STATE_IDLE: 937 944 default: … … 945 952 connection *next_con = req->con; 946 953 954 if (p->conf.debug) TRACE("wakeup a connection from backlog: con=%d", next_con->sock->fd); 947 955 joblist_append(srv, next_con); 948 956 … … 1534 1542 PATCH_OPTION(max_pool_size); 1535 1543 PATCH_OPTION(check_local); 1544 PATCH_OPTION(max_keep_alive_requests); 1536 1545 1537 1546 /* skip the first, the global context */ … … 1568 1577 } else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_PROXY_CORE_CHECK_LOCAL))) { 1569 1578 PATCH_OPTION(check_local); 1579 } else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_PROXY_CORE_MAX_KEEP_ALIVE))) { 1580 PATCH_OPTION(max_keep_alive_requests); 1570 1581 } 1571 1582 } … … 1658 1669 proxy_session *sess = con->plugin_ctx[p->id]; 1659 1670 1671 if (p->conf.debug) TRACE("proxy_connection_reset (%d)", con->sock->fd); 1660 1672 if (!sess) return HANDLER_GO_ON; 1661 1673 … … 1794 1806 req->con = con; 1795 1807 1796 #if 0 1797 TRACE("backlog: the con-pool is full, putting %s (%d) into the backlog", BUF_STR(con->uri.path), con->sock->fd); 1798 #endif 1808 if (p->conf.debug)TRACE("backlog: the con-pool is full, putting %s (%d) into the backlog", BUF_STR(con->uri.path), con->sock->fd); 1799 1809 proxy_backlog_push(p->conf.backlog, req); 1800 1810 … … 1875 1885 UNUSED(srv); 1876 1886 1887 if (p->conf.debug) TRACE("proxy_connection_close (%d)", con->sock->fd); 1877 1888 if (con->mode != p->id) return HANDLER_GO_ON; 1878 1889 … … 1938 1949 connection *con = req->con; 1939 1950 1951 if (p->debug) TRACE("wakeup a connection from backlog: con=%d", con->sock->fd); 1940 1952 joblist_append(srv, con); 1941 1953 -
trunk/src/mod_proxy_core.h
r1512 r1515 29 29 unsigned short max_pool_size; 30 30 unsigned short check_local; 31 unsigned short max_keep_alive_requests; 31 32 32 33 proxy_balance_t balancer; -
trunk/src/mod_proxy_core_backlog.c
r1496 r1515 87 87 cur->next = NULL; 88 88 89 proxy_request_free( req);89 proxy_request_free(cur); 90 90 91 91 return 0; -
trunk/src/mod_proxy_core_pool.c
r1496 r1515 113 113 */ 114 114 115 if ( address->used == pool->max_size) return PROXY_CONNECTIONPOOL_FULL;115 if (pool->used == pool->max_size) return PROXY_CONNECTIONPOOL_FULL; 116 116 117 117 proxy_con = proxy_connection_init(); -
trunk/src/mod_proxy_core_pool.h
r1496 r1515 24 24 iosocket *sock; 25 25 26 unsigned short request_count; /* used for max-keep-alive-requests */ 26 27 time_t last_read; /* timeout handling for keep-alive connections */ 27 28 time_t last_write;

