From a68e17cdb2632150c14620b20ebd8af2da779cc2 Mon Sep 17 00:00:00 2001 From: Graham Leggett Date: Wed, 20 Oct 2010 19:47:00 +0000 Subject: [PATCH] Optimise the set flags in the mod_proxy structures. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1025699 13f79535-47bb-0310-9956-ffa450edef68 --- modules/proxy/mod_proxy.h | 52 +++++++++++++++++++------------------- modules/proxy/proxy_util.c | 10 ++++---- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/modules/proxy/mod_proxy.h b/modules/proxy/mod_proxy.h index 500774b54c..b8c4a94f1f 100644 --- a/modules/proxy/mod_proxy.h +++ b/modules/proxy/mod_proxy.h @@ -157,14 +157,14 @@ typedef struct { status_full } proxy_status; /* Status display options */ - char req_set; - char viaopt_set; - char recv_buffer_size_set; - char io_buffer_size_set; - char maxfwd_set; - char timeout_set; - char badopt_set; - char proxy_status_set; + int req_set:1; + int viaopt_set:1; + int recv_buffer_size_set:1; + int io_buffer_size_set:1; + int maxfwd_set:1; + int timeout_set:1; + int badopt_set:1; + int proxy_status_set:1; } proxy_server_conf; @@ -184,6 +184,8 @@ typedef struct { apr_array_header_t* cookie_domains; const apr_strmatch_pattern* cookie_path_str; const apr_strmatch_pattern* cookie_domain_str; + signed char p_is_fnmatch; /* Is the path an fnmatch candidate? */ + signed char interpolate_env; /** * the following setting masks the error page @@ -193,11 +195,9 @@ typedef struct { * the error page, (so it will look like a error * returned from the rest of the system */ - int error_override; - signed char p_is_fnmatch; /* Is the path an fnmatch candidate? */ - signed char interpolate_env; - signed char preserve_host; - signed char preserve_host_set; + int error_override:1; + int preserve_host:1; + int preserve_host_set:1; int error_override_set:1; } proxy_dir_conf; @@ -338,15 +338,15 @@ struct proxy_worker { apr_thread_mutex_t *mutex; /* Thread lock for updating address cache */ #endif - char retry_set; - char timeout_set; - char acquire_set; - char ping_timeout_set; - char conn_timeout_set; - char recv_buffer_size_set; - char io_buffer_size_set; - char keepalive_set; - char disablereuse_set; + int retry_set:1; + int timeout_set:1; + int acquire_set:1; + int ping_timeout_set:1; + int conn_timeout_set:1; + int recv_buffer_size_set:1; + int io_buffer_size_set:1; + int keepalive_set:1; + int disablereuse_set:1; unsigned int apr_hash; /* hash #0 of worker name */ unsigned int our_hash; /* hash #1 of worker name. Why 2? hash collisions. */ }; @@ -366,11 +366,11 @@ struct proxy_balancer { const char *sticky_path; /* URL sticky session identifier */ apr_array_header_t *errstatuses; /* statuses to force members into error */ const char *sticky; /* sticky session identifier */ - int sticky_force; /* Disable failover for sticky sessions */ - int scolonsep; /* true if ';' seps sticky session paths */ - int max_attempts; /* Number of attempts before failing */ - char max_attempts_set; + + int sticky_force:1; /* Disable failover for sticky sessions */ + int scolonsep:1; /* true if ';' seps sticky session paths */ + int max_attempts_set:1; /* XXX: Perhaps we will need the proc mutex too. * Altrough we are only using arithmetic operations diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index 9bccc0ac3b..d5f1ae706f 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -1671,7 +1671,7 @@ PROXY_DECLARE(int) ap_proxy_connect_to_backend(apr_socket_t **newsock, } /* Set a timeout on the socket */ - if (conf->timeout_set == 1) { + if (conf->timeout_set) { apr_socket_timeout_set(*newsock, conf->timeout); } else { @@ -2501,10 +2501,10 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function, if (worker->conn_timeout_set) { apr_socket_timeout_set(newsock, worker->conn_timeout); } - else if (worker->timeout_set == 1) { + else if (worker->timeout_set) { apr_socket_timeout_set(newsock, worker->timeout); } - else if (conf->timeout_set == 1) { + else if (conf->timeout_set) { apr_socket_timeout_set(newsock, conf->timeout); } else { @@ -2540,10 +2540,10 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function, } /* Set a timeout on the socket */ - if (worker->timeout_set == 1) { + if (worker->timeout_set) { apr_socket_timeout_set(newsock, worker->timeout); } - else if (conf->timeout_set == 1) { + else if (conf->timeout_set) { apr_socket_timeout_set(newsock, conf->timeout); } else {