summaryrefslogtreecommitdiff
path: root/proxy_network.c
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2023-02-14 19:24:53 -0800
committerdormando <dormando@rydia.net>2023-02-15 12:56:23 -0800
commit2623ed4af53e8e8190d14c6215d9b3c39144e58d (patch)
tree2c81b64e755049422e430576f125dcfc5961dfe1 /proxy_network.c
parent58f81a51772163d641bc91b9af07756acad98bce (diff)
downloadmemcached-2623ed4af53e8e8190d14c6215d9b3c39144e58d.tar.gz
proxy: add read buffer data to backend errors
Errors like "trailing data" or "missingend" or etc are only useful if you're in a debugger and can break and inspect. This adds detail in uriencoding into the log message when applicable.
Diffstat (limited to 'proxy_network.c')
-rw-r--r--proxy_network.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/proxy_network.c b/proxy_network.c
index a80284c..71c1a0c 100644
--- a/proxy_network.c
+++ b/proxy_network.c
@@ -1196,6 +1196,7 @@ static int _reset_bad_backend(mcp_backend_t *be, enum proxy_be_failures err) {
io_pending_proxy_t *io = NULL;
// Can't use STAILQ_FOREACH() since return_io_pending() free's the current
// io. STAILQ_FOREACH_SAFE maybe?
+ int depth = be->depth;
while (!STAILQ_EMPTY(&be->io_head)) {
io = STAILQ_FIRST(&be->io_head);
STAILQ_REMOVE_HEAD(&be->io_head, io_next);
@@ -1209,6 +1210,8 @@ static int _reset_bad_backend(mcp_backend_t *be, enum proxy_be_failures err) {
STAILQ_INIT(&be->io_head);
be->io_next = NULL; // also reset the write offset.
+ LOGGER_LOG(NULL, LOG_PROXYEVENTS, LOGGER_PROXY_BE_ERROR, NULL, proxy_be_failure_text[err], be->name, be->port, depth, be->rbuf, be->rbufused);
+
// reset buffer to blank state.
be->rbufused = 0;
mcmc_disconnect(be->client);
@@ -1232,8 +1235,6 @@ static int _reset_bad_backend(mcp_backend_t *be, enum proxy_be_failures err) {
be->can_write = true;
}
- LOGGER_LOG(NULL, LOG_PROXYEVENTS, LOGGER_PROXY_BE_ERROR, NULL, proxy_be_failure_text[err], be->name, be->port);
-
return 0;
}