summaryrefslogtreecommitdiff
path: root/proxy_network.c
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2023-03-06 15:21:39 -0800
committerdormando <dormando@rydia.net>2023-03-06 18:10:21 -0800
commitdead60dd43d1b7213ac046d237920eff44b3f68b (patch)
treeb514f6f6cd99325b49c7ddb71ce710eed3dc786e /proxy_network.c
parent9e740a9abbe72f49bef026c85464f68e0e46757c (diff)
downloadmemcached-dead60dd43d1b7213ac046d237920eff44b3f68b.tar.gz
proxy: mcp.internal fixes and tests
- Refcount leak on sets - Move the response elapsed timer back closer to when the response was processed as to not clobber the wrong IO object data - Restores error messages from set/ms - Adds start of unit tests Requests will look like they run a tiiiiny bit faster than they do, but I need to get the elapsed time there for a later change.
Diffstat (limited to 'proxy_network.c')
-rw-r--r--proxy_network.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/proxy_network.c b/proxy_network.c
index 45ae98b..b25902d 100644
--- a/proxy_network.c
+++ b/proxy_network.c
@@ -966,6 +966,7 @@ static void _stop_timeout_event(mcp_backend_t *be) {
static int proxy_backend_drive_machine(mcp_backend_t *be) {
bool stop = false;
io_pending_proxy_t *p = NULL;
+ struct timeval end;
int flags = 0;
p = STAILQ_FIRST(&be->io_head);
@@ -1166,6 +1167,12 @@ static int proxy_backend_drive_machine(mcp_backend_t *be) {
STAILQ_REMOVE_HEAD(&be->io_head, io_next);
be->depth--;
be->pending_read--;
+
+ // stamp the elapsed time into the response object.
+ gettimeofday(&end, NULL);
+ p->client_resp->elapsed = (end.tv_sec - p->client_resp->start.tv_sec) * 1000000 +
+ (end.tv_usec - p->client_resp->start.tv_usec);
+
// have to do the q->count-- and == 0 and redispatch_conn()
// stuff here. The moment we call return_io here we
// don't own *p anymore.