From 14cfd3286b14aa9677a8542589adb4e6dd769d74 Mon Sep 17 00:00:00 2001 From: Soner Tari Date: Mon, 4 May 2020 21:24:09 +0300 Subject: [PATCH] Update ctime and first atime on conn handling thr, not on thrmgr This offloads the thrmgr by saving a time() call. Also remove an unnecessary NULL assignment. --- src/proxy.c | 5 ----- src/pxyconn.c | 3 +++ tests/testproxy/lp/prototcp.c | 3 +++ tests/testproxy/lp/proxy.c | 5 ----- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/proxy.c b/src/proxy.c index 42019f7..33a2fe4 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -178,11 +178,6 @@ proxy_conn_ctx_new(evutil_socket_t fd, ctx->global = global; ctx->clisock = clisock; - ctx->ctime = time(NULL); - ctx->atime = ctx->ctime; - - ctx->next = NULL; - #ifdef HAVE_LOCAL_PROCINFO ctx->lproc.pid = -1; #endif /* HAVE_LOCAL_PROCINFO */ diff --git a/src/pxyconn.c b/src/pxyconn.c index c2ba86d..b32ca26 100644 --- a/src/pxyconn.c +++ b/src/pxyconn.c @@ -1766,6 +1766,9 @@ pxy_conn_init(pxy_conn_ctx_t *ctx) pxy_thr_attach(ctx); + ctx->ctime = time(NULL); + ctx->atime = ctx->ctime; + if (check_fd_usage( #ifdef DEBUG_PROXY ctx diff --git a/tests/testproxy/lp/prototcp.c b/tests/testproxy/lp/prototcp.c index 28ec0e8..e759df2 100644 --- a/tests/testproxy/lp/prototcp.c +++ b/tests/testproxy/lp/prototcp.c @@ -235,6 +235,9 @@ prototcp_connect(UNUSED evutil_socket_t fd, UNUSED short what, void *arg) pxy_thr_attach(ctx); + ctx->ctime = time(NULL); + ctx->atime = ctx->ctime; + if (check_fd_usage( #ifdef DEBUG_PROXY ctx diff --git a/tests/testproxy/lp/proxy.c b/tests/testproxy/lp/proxy.c index ecf80f9..89acc35 100644 --- a/tests/testproxy/lp/proxy.c +++ b/tests/testproxy/lp/proxy.c @@ -135,11 +135,6 @@ proxy_conn_ctx_new(evutil_socket_t fd, } ctx->opts = opts; - - ctx->ctime = time(NULL); - ctx->atime = ctx->ctime; - - ctx->next = NULL; return ctx; }