Commit 06333493 authored by Jim Jagielski's avatar Jim Jagielski
Browse files

Merge r1727842 from trunk:

mod_heartmonitor: No need to search twice for the same value + fix some style
Submitted by: jailletc36
Reviewed/backported by: jim


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1731086 13f79535-47bb-0310-9956-ffa450edef68
parent c07bd712
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -112,10 +112,6 @@ RELEASE SHOWSTOPPERS:
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
  [ start all new proposals below, under PATCHES PROPOSED. ]

  *) mod_heartmonitor: No need to search twice for the same value + fix some style
     trunk patch:  http://svn.apache.org/r1727842
     2.4.x patch:  trunk works
     +1: jailletc36, jim, rpluem

PATCHES PROPOSED TO BACKPORT FROM TRUNK:
  [ New proposals should be added at the end of the list ]
+26 −15
Original line number Diff line number Diff line
@@ -272,6 +272,7 @@ static apr_status_t hm_file_update_stat(hm_ctx_t *ctx, hm_server_t *s, apr_pool_
            char buf[4096];
            const char *ip;
            apr_size_t bsize = sizeof(buf);

            apr_brigade_cleanup(tmpbb);
            if (APR_BRIGADE_EMPTY(bb)) {
                break;
@@ -293,45 +294,55 @@ static apr_status_t hm_file_update_stat(hm_ctx_t *ctx, hm_server_t *s, apr_pool_
            t = strchr(buf, ' ');
            if (t) {
                ip = apr_pstrmemdup(pool, buf, t - buf);
            } else {
            }
            else {
                ip = NULL;
            }

            if (!ip || buf[0] == '#') {
                /* copy things we can't process */
                apr_file_printf(fp, "%s\n", buf);
            } else if (strcmp(ip, s->ip) !=0 ) {
            }
            else if (strcmp(ip, s->ip) != 0 ) {
                hm_server_t node;
                apr_time_t seen;
                const char *val;

                /* Update seen time according to the last file modification */
                apr_table_clear(hbt);
                qs_to_table(apr_pstrdup(pool, t), hbt, pool);
                if (apr_table_get(hbt, "busy")) {
                    node.busy = atoi(apr_table_get(hbt, "busy"));
                } else {
                if ((val = apr_table_get(hbt, "busy"))) {
                    node.busy = atoi(val);
                }
                else {
                    node.busy = 0;
                }

                if (apr_table_get(hbt, "ready")) {
                    node.ready = atoi(apr_table_get(hbt, "ready"));
                } else {
                if ((val = apr_table_get(hbt, "ready"))) {
                    node.ready = atoi(val);
                }
                else {
                    node.ready = 0;
                }

                if (apr_table_get(hbt, "lastseen")) {
                    node.seen = atoi(apr_table_get(hbt, "lastseen"));
                } else {
                if ((val = apr_table_get(hbt, "lastseen"))) {
                    node.seen = atoi(val);
                }
                else {
                    node.seen = SEEN_TIMEOUT;
                }
                seen = fage + node.seen;

                if (apr_table_get(hbt, "port")) {
                    node.port = atoi(apr_table_get(hbt, "port"));
                } else {
                if ((val = apr_table_get(hbt, "port"))) {
                    node.port = atoi(val);
                }
                else {
                    node.port = 80;
                }
                apr_file_printf(fp, "%s &ready=%u&busy=%u&lastseen=%u&port=%u\n",
                                ip, node.ready, node.busy, (unsigned int) seen, node.port);
            } else {
            }
            else {
                apr_time_t seen;
                seen = apr_time_sec(now - s->seen);
                apr_file_printf(fp, "%s &ready=%u&busy=%u&lastseen=%u&port=%u\n",