]> granicus.if.org Git - apache/commitdiff
Make ctx:status an apr_status_t, and be consistent about checking and setting it.
authorPaul Querna <pquerna@apache.org>
Sun, 7 Dec 2008 06:15:40 +0000 (06:15 +0000)
committerPaul Querna <pquerna@apache.org>
Sun, 7 Dec 2008 06:15:40 +0000 (06:15 +0000)
Suggested by: Takashi Sato <takashi lans-tv.com>

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@724091 13f79535-47bb-0310-9956-ffa450edef68

modules/cluster/mod_heartbeat.c
modules/cluster/mod_heartmonitor.c

index bb62920cc96297c1f7a76ede0d3589ef896c6d57..1f978db645722bf3870f6c4ac54f72e8d5a866a7 100644 (file)
@@ -34,7 +34,7 @@ typedef struct hb_ctx_t
     apr_sockaddr_t *mcast_addr;
     int server_limit;
     int thread_limit;
-    int status;
+    apr_status_t status;
     volatile int keep_running;
     apr_proc_mutex_t *mutex;
     const char *mutex_path;
@@ -125,7 +125,7 @@ static void* APR_THREAD_FUNC hb_worker(apr_thread_t *thd, void *data)
 
     apr_pool_t *pool = apr_thread_pool_get(thd);
     apr_pool_tag(pool, "heartbeat_worker");
-    ctx->status = 0;
+    ctx->status = APR_SUCCESS;
     ctx->keep_running = 1;
     apr_thread_mutex_unlock(ctx->start_mtx);
 
@@ -218,11 +218,11 @@ static void hb_child_init(apr_pool_t *p, server_rec *s)
     if (ctx->active) {
         apr_proc_mutex_child_init(&ctx->mutex, ctx->mutex_path, p);
         
-        ctx->status = -1;
+        ctx->status = APR_EGENERAL;
         
         start_hb_worker(p, ctx);
-        if (ctx->status != 0) {
-            ap_log_error(APLOG_MARK, APLOG_CRIT, 0, s,
+        if (ctx->status) {
+            ap_log_error(APLOG_MARK, APLOG_CRIT, ctx->status, s,
                          "Heartbeat: Failed to start worker thread.");
             return;
         }
index 6d07d95cf3569690192ab9d6f92d5a133ed90eb1..d54d6e9ca47f7cd305ad465da3a5f5ab2b1439fb 100644 (file)
@@ -46,7 +46,7 @@ typedef struct hm_ctx_t
     apr_proc_mutex_t *mutex;
     const char *mutex_path;
     apr_sockaddr_t *mcast_addr;
-    int status;
+    apr_status_t status;
     volatile int keep_running;
     apr_thread_mutex_t *start_mtx;
     apr_thread_t *thread;
@@ -294,7 +294,7 @@ static void* APR_THREAD_FUNC hm_worker(apr_thread_t *thd, void *data)
     apr_status_t rv;
 
     ctx->p = apr_thread_pool_get(thd);
-    ctx->status = 0;
+    ctx->status = APR_SUCCESS;
     ctx->keep_running = 1;
     apr_thread_mutex_unlock(ctx->start_mtx);
 
@@ -427,12 +427,12 @@ static void hm_child_init(apr_pool_t *p, server_rec *s)
                  "Heartmonitor: Starting Listener Thread. mcast=%pI",
                  ctx->mcast_addr);
 
-    ctx->status = -1;
+    ctx->status = APR_EGENERAL;
 
     start_hm_worker(p, ctx);
 
-    if (ctx->status != 0) {
-        ap_log_error(APLOG_MARK, APLOG_CRIT, 0, s,
+    if (ctx->status) {
+        ap_log_error(APLOG_MARK, APLOG_CRIT, ctx->status, s,
                      "Heartmonitor: Failed to start listener thread.");
         return;
     }