You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2009/09/30 20:58:34 UTC

svn commit: r820388 - /httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_heartbeat.c

Author: jim
Date: Wed Sep 30 18:58:34 2009
New Revision: 820388

URL: http://svn.apache.org/viewvc?rev=820388&view=rev
Log:
Try to have consistent interface regardless of slotmem or
file-based.

Modified:
    httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_heartbeat.c

Modified: httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_heartbeat.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_heartbeat.c?rev=820388&r1=820387&r2=820388&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_heartbeat.c (original)
+++ httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_heartbeat.c Wed Sep 30 18:58:34 2009
@@ -232,6 +232,18 @@
     return APR_SUCCESS;
 }
 
+
+static apr_status_t read_heartbeats(const char *path, apr_hash_t *servers,
+                                        apr_pool_t *pool)
+{
+    apr_status_t rv;
+    if (hm_serversmem)
+        rv = readslot_heartbeats(servers, pool);
+    else
+        rv = readfile_heartbeats(path, servers, pool);
+    return rv;
+}
+
 /*
  * Finding a random number in a range. 
  *      n' = a + n(b-a+1)/(M+1)
@@ -283,10 +295,7 @@
 
     servers = apr_hash_make(tpool);
 
-    if (hm_serversmem)
-        rv = readslot_heartbeats(servers, tpool);
-    else
-        rv = readfile_heartbeats(ctx->path, servers, tpool);
+    rv = read_heartbeats(ctx->path, servers, tpool);
 
     if (rv) {
         ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
@@ -371,7 +380,9 @@
     void *data;
     apr_size_t size;
     unsigned int num;
-
+    lb_hb_ctx_t *ctx = ap_get_module_config(s->module_config,
+                                            &lbmethod_heartbeat_module);
+    
     apr_pool_userdata_get(&data, userdata_key, s->process->pool);
     if (!data) {
         /* first call do nothing */
@@ -391,6 +402,9 @@
     } else
         ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, s, "Using slotmem from mod_heartmonitor");
 
+    if (hm_serversmem)
+        ctx->path = "(slotmem)";
+
     return OK;
 }