Browse Source

Demote various messages in proxy mode but add more information to warnings

master
Con Kolivas 10 years ago
parent
commit
288e4b67bb
  1. 7
      src/ckpool.c
  2. 2
      src/ckpool.h
  3. 8
      src/generator.c

7
src/ckpool.c

@ -424,8 +424,12 @@ int read_socket_line(connsock_t *cs, const int timeout)
if (ret < 1) { if (ret < 1) {
if (!ret) if (!ret)
LOGDEBUG("Select timed out in read_socket_line"); LOGDEBUG("Select timed out in read_socket_line");
else {
if (cs->ckp->proxy)
LOGNOTICE("Select failed in read_socket_line");
else else
LOGERR("Select failed in read_socket_line"); LOGERR("Select failed in read_socket_line");
}
goto out; goto out;
} }
ret = recv(fd, readbuf, PAGESIZE - 4, 0); ret = recv(fd, readbuf, PAGESIZE - 4, 0);
@ -433,6 +437,9 @@ int read_socket_line(connsock_t *cs, const int timeout)
/* Closed socket after valid message */ /* Closed socket after valid message */
if (!ret && eom) if (!ret && eom)
break; break;
if (cs->ckp->proxy)
LOGNOTICE("Failed to recv in read_socket_line");
else
LOGERR("Failed to recv in read_socket_line"); LOGERR("Failed to recv in read_socket_line");
ret = -1; ret = -1;
goto out; goto out;

2
src/ckpool.h

@ -19,7 +19,6 @@
#include "libckpool.h" #include "libckpool.h"
#include "uthash.h" #include "uthash.h"
struct ckpool_instance;
typedef struct ckpool_instance ckpool_t; typedef struct ckpool_instance ckpool_t;
struct ckmsg { struct ckmsg {
@ -61,6 +60,7 @@ struct connsock {
char *buf; char *buf;
int bufofs; int bufofs;
int buflen; int buflen;
ckpool_t *ckp;
}; };
typedef struct connsock connsock_t; typedef struct connsock connsock_t;

8
src/generator.c

@ -952,6 +952,7 @@ static bool parse_reconnect(proxy_instance_t *proxi, json_t *val)
newproxi->si = newsi; newproxi->si = newsi;
newproxi->ckp = ckp; newproxi->ckp = ckp;
newproxi->cs = &newsi->cs; newproxi->cs = &newsi->cs;
newproxi->cs->ckp = ckp;
newproxi->id = newsi->id; newproxi->id = newsi->id;
HASH_ADD_INT(gdata->proxies, id, proxi); HASH_ADD_INT(gdata->proxies, id, proxi);
HASH_ADD_INT(gdata->proxies, id, newproxi); HASH_ADD_INT(gdata->proxies, id, newproxi);
@ -1468,7 +1469,8 @@ static void *passthrough_recv(void *arg)
} while (ret == 0); } while (ret == 0);
if (ret < 1) { if (ret < 1) {
LOGWARNING("Failed to read_socket_line in proxy_recv, attempting reconnect"); LOGWARNING("Proxy %d:%s failed to read_socket_line in proxy_recv, attempting reconnect",
proxi->id, proxi->si->url);
continue; continue;
} }
/* Simply forward the message on, as is, to the connector to /* Simply forward the message on, as is, to the connector to
@ -1558,7 +1560,8 @@ static void *proxy_recv(void *arg)
if (ret < 1) { if (ret < 1) {
/* Send ourselves a reconnect message */ /* Send ourselves a reconnect message */
LOGWARNING("Failed to read_socket_line in proxy_recv, attempting reconnect"); LOGWARNING("Proxy %d:%s failed to read_socket_line in proxy_recv, attempting reconnect",
proxi->id, proxi->si->url);
continue; continue;
} }
if (parse_method(proxi, cs->buf)) { if (parse_method(proxi, cs->buf)) {
@ -1791,6 +1794,7 @@ static int proxy_mode(ckpool_t *ckp, proc_instance_t *pi)
proxi->si = si; proxi->si = si;
proxi->ckp = ckp; proxi->ckp = ckp;
proxi->cs = &si->cs; proxi->cs = &si->cs;
proxi->cs->ckp = ckp;
mutex_init(&proxi->notify_lock); mutex_init(&proxi->notify_lock);
mutex_init(&proxi->share_lock); mutex_init(&proxi->share_lock);
} }

Loading…
Cancel
Save