From 44287f9e6722bcdbdb2cda679407a265697cbeb7 Mon Sep 17 00:00:00 2001 From: tiptorrent development team Date: Sun, 19 Sep 2021 22:42:48 +0200 Subject: do not activate clients without redirection via POST update 4573deb8cb3 to skip clients without redirection after receiving POST notification. --- src/core.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/core.c') diff --git a/src/core.c b/src/core.c index dff5a7c..c107fd8 100644 --- a/src/core.c +++ b/src/core.c @@ -51,7 +51,7 @@ static void tip_client_release(struct ev_loop *loop, struct tip_client *cli) if (cli->method == TIP_METHOD_GET) { if (tip_client_large_file(cli)) { num_clients--; - tip_client_activate_pending(); + tip_client_activate_pending(false); } } @@ -351,15 +351,18 @@ void tip_client_pending(struct tip_client *cli) cli->state = TIP_CLIENT_PENDING; } -void tip_client_activate_pending(void) +void tip_client_activate_pending(bool redirect_only) { struct tip_client *cli, *next; + bool redirected; list_for_each_entry_safe(cli, next, &client_list, list) { if (cli->state != TIP_CLIENT_PENDING) continue; + redirected = tip_client_redirect(cli); + if (!redirected && redirect_only) + continue; - tip_client_redirect(cli); ev_io_set(&cli->io, tip_client_socket(cli), EV_READ | EV_WRITE); ev_io_start(tip_main_loop, &cli->io); ev_timer_again(tip_main_loop, &cli->timer); -- cgit v1.2.3-18-g5258