Skip to content

Commit

Permalink
* Changed verbosity levels a bit so that function entry is > 2
Browse files Browse the repository at this point in the history
* added ERROR in verbosity printout where error condition
  • Loading branch information
CaptTofu committed Sep 17, 2009
1 parent 3bffb17 commit 8d6ae29
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 69 deletions.
40 changes: 20 additions & 20 deletions agent_config.c
Expand Up @@ -238,7 +238,7 @@ proxy_main *cproxy_init_agent_start(char *jid,
assert(jpw);
assert(config_path);

if (settings.verbose > 1) {
if (settings.verbose > 2) {
fprintf(stderr, "cproxy_init_agent_start\n");;
}

Expand Down Expand Up @@ -273,7 +273,7 @@ proxy_main *cproxy_init_agent_start(char *jid,
config.log = agent_logger;

if (start_conflate(config)) {
if (settings.verbose > 1) {
if (settings.verbose > 2) {
fprintf(stderr, "cproxy_init done\n");
}

Expand All @@ -299,7 +299,7 @@ void on_conflate_new_config(void *userdata, kvpair_t *config) {
LIBEVENT_THREAD *mthread = thread_by_index(0);
assert(mthread != NULL);

if (settings.verbose > 1) {
if (settings.verbose > 2) {
fprintf(stderr, "agent_config ocnc on_conflate_new_config\n");
}

Expand Down Expand Up @@ -338,7 +338,7 @@ void cproxy_on_new_config(void *data0, void *data1) {

uint32_t new_config_ver = max_config_ver + 1;

if (settings.verbose > 1) {
if (settings.verbose > 2) {
fprintf(stderr, "conc new_config_ver %u\n", new_config_ver);
}

Expand Down Expand Up @@ -472,7 +472,7 @@ void cproxy_on_new_config(void *data0, void *data1) {
servers, &behavior_pool);
if (config_str != NULL &&
config_str[0] != '\0') {
if (settings.verbose > 1) {
if (settings.verbose > 2) {
fprintf(stderr, "conc config: %s\n",
config_str);
}
Expand All @@ -487,7 +487,7 @@ void cproxy_on_new_config(void *data0, void *data1) {
free(behavior_pool.arr);
} else {
if (settings.verbose > 1) {
fprintf(stderr, "oom on re-config malloc\n");;
fprintf(stderr, "ERROR: oom on re-config malloc\n");;
}
goto fail;
}
Expand All @@ -498,7 +498,7 @@ void cproxy_on_new_config(void *data0, void *data1) {
}
} else {
if (settings.verbose > 1) {
fprintf(stderr, "conc missing pool port\n");
fprintf(stderr, "ERROR: conc missing pool port\n");
}
goto fail;
}
Expand All @@ -509,7 +509,7 @@ void cproxy_on_new_config(void *data0, void *data1) {
}
} else {
if (settings.verbose > 1) {
fprintf(stderr, "conc missing pool name\n");
fprintf(stderr, "ERROR: conc missing pool name\n");
}
goto fail;
}
Expand Down Expand Up @@ -570,7 +570,7 @@ void cproxy_on_new_config(void *data0, void *data1) {
free_kvpair(kvs);

if (settings.verbose > 1) {
fprintf(stderr, "conc failed config %llu\n",
fprintf(stderr, "ERROR: conc failed config %llu\n",
(long long unsigned int) m->stat_config_fails);
}
}
Expand Down Expand Up @@ -624,7 +624,7 @@ void cproxy_on_new_pool(proxy_main *m,

int n = cproxy_listen(p);
if (n > 0) {
if (settings.verbose > 1) {
if (settings.verbose > 2) {
fprintf(stderr,
"cproxy_listen success %u to %s with %d conns\n",
p->port, p->config, n);
Expand All @@ -633,14 +633,14 @@ void cproxy_on_new_pool(proxy_main *m,
} else {
if (settings.verbose > 1) {
fprintf(stderr,
"cproxy_listen failed on %u to %s\n",
"ERROR: cproxy_listen failed on %u to %s\n",
p->port, p->config);
}
m->stat_proxy_start_fails++;
}
}
} else {
if (settings.verbose > 1) {
if (settings.verbose > 2) {
fprintf(stderr, "conp existing config change %u\n",
p->port);
}
Expand All @@ -658,7 +658,7 @@ void cproxy_on_new_pool(proxy_main *m,

pthread_mutex_lock(&p->proxy_lock);

if (settings.verbose > 1) {
if (settings.verbose > 2) {
if (p->config && config &&
strcmp(p->config, config) != 0) {
fprintf(stderr,
Expand Down Expand Up @@ -701,7 +701,7 @@ void cproxy_on_new_pool(proxy_main *m,

pthread_mutex_unlock(&p->proxy_lock);

if (settings.verbose > 1) {
if (settings.verbose > 2) {
fprintf(stderr, "conp changed %s, shutdown %s\n",
changed ? "true" : "false",
shutdown ? "true" : "false");
Expand Down Expand Up @@ -818,12 +818,12 @@ static void update_ptd_config(void *data0, void *data1) {
}
}

if (settings.verbose > 1) {
if (settings.verbose > 2) {
fprintf(stderr, "update_ptd_config %u, %u to %u\n",
port, prev, ptd->config_ver);
}
} else {
if (settings.verbose > 1) {
if (settings.verbose > 2) {
fprintf(stderr, "update_ptd_config %u, %u = %u no change\n",
port, prev, ptd->config_ver);
}
Expand All @@ -846,7 +846,7 @@ static bool update_str_config(char **curr, char *next, char *descrip) {
rv = true;

if (descrip != NULL &&
settings.verbose > 1) {
settings.verbose > 2) {
fprintf(stderr, "%s\n", descrip);
}
}
Expand Down Expand Up @@ -877,7 +877,7 @@ static bool update_behaviors_config(proxy_behavior **curr,
rv = true;

if (descrip != NULL &&
settings.verbose > 1) {
settings.verbose > 2) {
fprintf(stderr, "%s\n", descrip);
}
}
Expand Down Expand Up @@ -955,7 +955,7 @@ char *parse_kvs_servers(char *prefix,
} else {
if (settings.verbose > 1) {
fprintf(stderr,
"missing host:port for svr-%s in %s\n",
"ERROR: missing host:port for svr-%s in %s\n",
servers[j], pool_name);
}
}
Expand All @@ -968,7 +968,7 @@ char *parse_kvs_servers(char *prefix,
behavior_pool->arr[j].downstream_weight);
}

if (settings.verbose > 1) {
if (settings.verbose > 2) {
cproxy_dump_behavior(&behavior_pool->arr[j],
"pks", 0);
}
Expand Down

0 comments on commit 8d6ae29

Please sign in to comment.