Skip to content

Commit

Permalink
Make error messages starting the stats server clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
TysonAndre committed Jul 4, 2021
1 parent 4700e93 commit 2d49179
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
exactly one server (tyson)
Support memcache 'version' requests by proxying the request to a single
backend memcache server to fetch the server version. (tyson)
Make error messages for creating the stats server during startup clearer. (tyson)

2015-22-06 Manju Rajashekhar <[email protected]>
* twemproxy: version 0.4.1 release
Expand Down
9 changes: 5 additions & 4 deletions src/nc_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -831,24 +831,25 @@ stats_listen(struct stats *st)

status = nc_set_reuseaddr(st->sd);
if (status < 0) {
log_error("set reuseaddr on m %d failed: %s", st->sd, strerror(errno));
log_error("set reuseaddr on m %d failed for stats server: %s", st->sd, strerror(errno));
return NC_ERROR;
}

status = bind(st->sd, (struct sockaddr *)&si.addr, si.addrlen);
if (status < 0) {
log_error("bind on m %d to addr '%.*s:%u' failed: %s", st->sd,
log_error("bind on m %d to stats server addr '%.*s:%u' failed: %s", st->sd,
st->addr.len, st->addr.data, st->port, strerror(errno));
return NC_ERROR;
}

status = listen(st->sd, SOMAXCONN);
if (status < 0) {
log_error("listen on m %d failed: %s", st->sd, strerror(errno));
log_error("listen on m %d for stats server '%.*s:%u' failed: %s", st->sd,
st->addr.len, st->addr.data, st->port, strerror(errno));
return NC_ERROR;
}

log_debug(LOG_NOTICE, "m %d listening on '%.*s:%u'", st->sd,
log_debug(LOG_NOTICE, "m %d listening on stats server '%.*s:%u'", st->sd,
st->addr.len, st->addr.data, st->port);

return NC_OK;
Expand Down
1 change: 1 addition & 0 deletions src/proto/nc_memcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -1518,6 +1518,7 @@ memcache_copy_bulk(struct msg *dst, struct msg *src)
for (; p < last && ('\r' != *p); p++) { /* eat cas for gets */
;
}
/* "*p" should be pointing to '\r' */

len += CRLF_LEN * 2;
len += (p - mbuf->pos);
Expand Down

0 comments on commit 2d49179

Please sign in to comment.