summaryrefslogtreecommitdiffstats
path: root/modules/cluster/mod_heartbeat.c
diff options
context:
space:
mode:
authorPaul Querna <pquerna@apache.org>2008-12-01 04:10:49 +0100
committerPaul Querna <pquerna@apache.org>2008-12-01 04:10:49 +0100
commitef70cebf29faffb3c4e36524e80b4b4a12494454 (patch)
tree9c4ab22fdab67c07486e37d45635b22db5a57411 /modules/cluster/mod_heartbeat.c
parentAdd two new modules to handle load balancing across multiple apache servers (diff)
downloadapache2-ef70cebf29faffb3c4e36524e80b4b4a12494454.tar.xz
apache2-ef70cebf29faffb3c4e36524e80b4b4a12494454.zip
Move variable declartions to the top of functions for c89'ness.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@721956 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/cluster/mod_heartbeat.c')
-rw-r--r--modules/cluster/mod_heartbeat.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/modules/cluster/mod_heartbeat.c b/modules/cluster/mod_heartbeat.c
index 0d612c7add..77f08be824 100644
--- a/modules/cluster/mod_heartbeat.c
+++ b/modules/cluster/mod_heartbeat.c
@@ -49,6 +49,9 @@ static const char *msg_format = "v=%u&ready=%u&busy=%u";
static int hb_monitor(hb_ctx_t *ctx, apr_pool_t *p)
{
+ apr_size_t len;
+ apr_socket_t *sock = NULL;
+ char buf[256];
int i, j;
apr_uint32_t ready = 0;
apr_uint32_t busy = 0;
@@ -74,11 +77,8 @@ static int hb_monitor(hb_ctx_t *ctx, apr_pool_t *p)
}
}
- char buf[256];
- apr_size_t len =
- apr_snprintf(buf, sizeof(buf), msg_format, MSG_VERSION, ready, busy);
+ len = apr_snprintf(buf, sizeof(buf), msg_format, MSG_VERSION, ready, busy);
- apr_socket_t *sock = NULL;
do {
apr_status_t rv;
rv = apr_socket_create(&sock, ctx->mcast_addr->family,
@@ -136,6 +136,8 @@ static void *hb_worker(apr_thread_t *thd, void *data)
while (ctx->keep_running) {
int mpm_state = 0;
+ apr_pool_t *tpool;
+
rv = ap_mpm_query(AP_MPMQ_MPM_STATE, &mpm_state);
if (rv != APR_SUCCESS) {
@@ -147,7 +149,6 @@ static void *hb_worker(apr_thread_t *thd, void *data)
break;
}
- apr_pool_t *tpool;
apr_pool_create(&tpool, pool);
apr_pool_tag(tpool, "heartbeat_worker_temp");
hb_monitor(ctx, tpool);
@@ -276,6 +277,8 @@ static const char *cmd_hb_address(cmd_parms *cmd,
void *dconf, const char *addr)
{
apr_status_t rv;
+ const char *tmpdir = NULL;
+ char *path;
char *host_str;
char *scope_id;
apr_port_t port = 0;
@@ -312,13 +315,12 @@ static const char *cmd_hb_address(cmd_parms *cmd,
return "HeartbeatAddress: apr_sockaddr_info_get failed.";
}
- const char *tmpdir = NULL;
rv = apr_temp_dir_get(&tmpdir, p);
if (rv) {
return "HeartbeatAddress: unable to find temp directory.";
}
- char *path = apr_pstrcat(p, tmpdir, "/hb-tmp.XXXXXX", NULL);
+ path = apr_pstrcat(p, tmpdir, "/hb-tmp.XXXXXX", NULL);
rv = apr_file_mktemp(&ctx->lockf, path, 0, p);