You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jf...@apache.org on 2009/04/07 15:38:02 UTC

svn commit: r762771 - /httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c

Author: jfclere
Date: Tue Apr  7 13:38:01 2009
New Revision: 762771

URL: http://svn.apache.org/viewvc?rev=762771&view=rev
Log:
Arrange traces.

Modified:
    httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c

Modified: httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c?rev=762771&r1=762770&r2=762771&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c (original)
+++ httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c Tue Apr  7 13:38:01 2009
@@ -66,14 +66,14 @@
                            SOCK_DGRAM, APR_PROTO_UDP, ctx->p);
 
     if (rv) {
-        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
+        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ctx->s,
                      "Heartmonitor: Failed to create listening socket.");
         return rv;
     }
 
     rv = apr_socket_opt_set(ctx->sock, APR_SO_REUSEADDR, 1);
     if (rv) {
-        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
+        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ctx->s,
                      "Heartmonitor: Failed to set APR_SO_REUSEADDR to 1 on socket.");
         return rv;
     }
@@ -81,14 +81,14 @@
 
     rv = apr_socket_opt_set(ctx->sock, APR_SO_NONBLOCK, 1);
     if (rv) {
-        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
+        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ctx->s,
                      "Heartmonitor: Failed to set APR_SO_REUSEADDR to 1 on socket.");
         return rv;
     }
 
     rv = apr_socket_bind(ctx->sock, ctx->mcast_addr);
     if (rv) {
-        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
+        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ctx->s,
                      "Heartmonitor: Failed to bind on socket.");
         return rv;
     }
@@ -96,14 +96,14 @@
     rv = apr_mcast_join(ctx->sock, ctx->mcast_addr, NULL, NULL);
 
     if (rv) {
-        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
+        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ctx->s,
                      "Heartmonitor: Failed to join multicast group");
         return rv;
     }
 
     rv = apr_mcast_loopback(ctx->sock, 1);
     if (rv) {
-        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
+        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ctx->s,
                      "Heartmonitor: Failed to accept localhost mulitcast on socket.");
         return rv;
     }
@@ -162,7 +162,7 @@
     rv = apr_file_mktemp(&fp, path, APR_CREATE | APR_WRITE, p);
 
     if (rv) {
-        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
+        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ctx->s,
                      "Heartmonitor: Unable to open tmp file: %s", path);
         return rv;
     }
@@ -188,14 +188,14 @@
 
     rv = apr_file_flush(fp);
     if (rv) {
-      ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
+      ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ctx->s,
                    "Heartmonitor: Unable to flush file: %s", path);
       return rv;
     }
 
     rv = apr_file_close(fp);
     if (rv) {
-      ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
+      ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ctx->s,
                    "Heartmonitor: Unable to close file: %s", path);
       return rv;
     }
@@ -204,7 +204,7 @@
                             APR_FPROT_UREAD | APR_FPROT_GREAD |
                             APR_FPROT_WREAD);
     if (rv && rv != APR_INCOMPLETE) {
-        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
+        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ctx->s,
                      "Heartmonitor: Unable to set file permssions on %s",
                      path);
         return rv;
@@ -213,7 +213,7 @@
     rv = apr_file_rename(path, ctx->storage_path, p);
 
     if (rv) {
-        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
+        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ctx->s,
                      "Heartmonitor: Unable to move file: %s -> %s", path,
                      ctx->storage_path);
         return rv;
@@ -254,12 +254,12 @@
     rv = apr_socket_recvfrom(&from, ctx->sock, 0, buf, &len);
 
     if (APR_STATUS_IS_EAGAIN(rv)) {
-        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
+        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ctx->s,
                      "Heartmonitor: would block");
         return APR_SUCCESS;
     }
     else if (rv) {
-        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
+        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ctx->s,
                      "Heartmonitor: recvfrom failed");
         return rv;
     }
@@ -276,7 +276,7 @@
         char *ip;
         hm_server_t *s;
         /* TODO: REMOVE ME BEFORE PRODUCTION (????) */
-        ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, NULL,
+        ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, ctx->s,
                      "Heartmonitor: %pI busy=%s ready=%s", &from,
                      apr_table_get(tbl, "busy"), apr_table_get(tbl, "ready"));
 
@@ -289,7 +289,7 @@
         s->seen = apr_time_now();
     }
     else {
-        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
+        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ctx->s,
                      "Heartmonitor: malformed multicast message from %pI",
                      &from);
     }
@@ -313,7 +313,7 @@
             rv = hm_listen(ctx);
             if (rv) {
                 ctx->status = rv;
-                ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
+                ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ctx->s,
                              "Heartmonitor: Unable to listen for connections!");
             }
             else {
@@ -343,6 +343,7 @@
                 pfd.p = p;
                 pfd.reqevents = APR_POLLIN;
 
+                // timeout = apr_time_from_sec((apr_time_sec(ctx->interval) - now + cur)>1 ? (apr_time_sec(ctx->interval) - now + cur) : 1);
                 timeout = apr_time_from_sec(1);
 
                 rc = apr_poll(&pfd, 1, &n, timeout);
@@ -404,7 +405,7 @@
                      "callback (%s)", HM_WATHCHDOG_NAME);
         return !OK;
     }
-    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, NULL,
+    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
                  "Heartmonitor: wd callback %s", HM_WATHCHDOG_NAME);
 
     return OK;



Re: svn commit: r762771 - /httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c

Posted by Ruediger Pluem <rp...@apache.org>.

On 04/07/2009 03:38 PM, jfclere@apache.org wrote:
> Author: jfclere
> Date: Tue Apr  7 13:38:01 2009
> New Revision: 762771
> 
> URL: http://svn.apache.org/viewvc?rev=762771&view=rev
> Log:
> Arrange traces.
> 
> Modified:
>     httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c
> 
> Modified: httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c?rev=762771&r1=762770&r2=762771&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c (original)
> +++ httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c Tue Apr  7 13:38:01 2009
             }
>              else {
> @@ -343,6 +343,7 @@
>                  pfd.p = p;
>                  pfd.reqevents = APR_POLLIN;
>  
> +                // timeout = apr_time_from_sec((apr_time_sec(ctx->interval) - now + cur)>1 ? (apr_time_sec(ctx->interval) - now + cur) : 1);

This is a C++ style comment that fails on pure ANSI C compilers. Furthermore it
does not seem to be a meaningful comment.
I guess this is from some of your internal tests and sneaked into the commit.

Regards

RĂ¼diger