diff --git a/src/ckpool.c b/src/ckpool.c index 7f2f0ff5..3d122a61 100644 --- a/src/ckpool.c +++ b/src/ckpool.c @@ -424,8 +424,12 @@ int read_socket_line(connsock_t *cs, const int timeout) if (ret < 1) { if (!ret) LOGDEBUG("Select timed out in read_socket_line"); - else - LOGERR("Select failed in read_socket_line"); + else { + if (cs->ckp->proxy) + LOGNOTICE("Select failed in read_socket_line"); + else + LOGERR("Select failed in read_socket_line"); + } goto out; } ret = recv(fd, readbuf, PAGESIZE - 4, 0); @@ -433,7 +437,10 @@ int read_socket_line(connsock_t *cs, const int timeout) /* Closed socket after valid message */ if (!ret && eom) break; - LOGERR("Failed to recv in read_socket_line"); + if (cs->ckp->proxy) + LOGNOTICE("Failed to recv in read_socket_line"); + else + LOGERR("Failed to recv in read_socket_line"); ret = -1; goto out; } diff --git a/src/ckpool.h b/src/ckpool.h index f2d8bb3b..3f6935ae 100644 --- a/src/ckpool.h +++ b/src/ckpool.h @@ -19,7 +19,6 @@ #include "libckpool.h" #include "uthash.h" -struct ckpool_instance; typedef struct ckpool_instance ckpool_t; struct ckmsg { @@ -61,6 +60,7 @@ struct connsock { char *buf; int bufofs; int buflen; + ckpool_t *ckp; }; typedef struct connsock connsock_t; diff --git a/src/generator.c b/src/generator.c index a265b41e..7d472fdf 100644 --- a/src/generator.c +++ b/src/generator.c @@ -952,6 +952,7 @@ static bool parse_reconnect(proxy_instance_t *proxi, json_t *val) newproxi->si = newsi; newproxi->ckp = ckp; newproxi->cs = &newsi->cs; + newproxi->cs->ckp = ckp; newproxi->id = newsi->id; HASH_ADD_INT(gdata->proxies, id, proxi); HASH_ADD_INT(gdata->proxies, id, newproxi); @@ -1468,7 +1469,8 @@ static void *passthrough_recv(void *arg) } while (ret == 0); 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; } /* Simply forward the message on, as is, to the connector to @@ -1558,7 +1560,8 @@ static void *proxy_recv(void *arg) if (ret < 1) { /* 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; } 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->ckp = ckp; proxi->cs = &si->cs; + proxi->cs->ckp = ckp; mutex_init(&proxi->notify_lock); mutex_init(&proxi->share_lock); }