kore

An easy to use, scalable and secure web application framework for writing web APIs in C.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit 2316f1016dcc7d6acbc7674897384837f857626f
parent 74432aeff71116f733d0b6de1ccb09091bb36ee6
Author: Joris Vink <joris@coders.se>
Date:   Fri, 26 Jun 2020 12:25:07 +0200

Always prune disconnected clients at the end of the event loop.

Diffstat:
src/worker.c | 11++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/worker.c b/src/worker.c @@ -349,7 +349,7 @@ kore_worker_entry(struct kore_worker *kw) struct kore_runtime_call *rcall; u_int64_t last_seed; int quit, had_lock; - u_int64_t netwait, now, next_prune; + u_int64_t netwait, now, next_timeo; worker = kw; @@ -400,7 +400,7 @@ kore_worker_entry(struct kore_worker *kw) quit = 0; had_lock = 0; - next_prune = 0; + next_timeo = 0; accept_avail = 1; worker_active_connections = 0; @@ -525,11 +525,12 @@ kore_worker_entry(struct kore_worker *kw) #if defined(KORE_USE_PYTHON) kore_python_coro_run(); #endif - if (next_prune <= now) { + if (next_timeo <= now) { kore_connection_check_timeout(now); - kore_connection_prune(KORE_CONNECTION_PRUNE_DISCONNECT); - next_prune = now + 500; + next_timeo = now + 500; } + + kore_connection_prune(KORE_CONNECTION_PRUNE_DISCONNECT); } rcall = kore_runtime_getcall("kore_worker_teardown");