summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortiptorrent development team <tiptorrent@soleta.eu>2021-09-25 21:12:35 +0200
committertiptorrent development team <tiptorrent@soleta.eu>2021-09-29 15:49:19 +0200
commit6a81079dc1a9d4deea7d8faa787baed2ffe80556 (patch)
tree2312346da4157482913307fa3b2a1df96dd658ac
parent8e939e3905733abfd461fa3e59d14b6286667129 (diff)
Revert "prioritize direct download for non existing redirections"
This reverts commit 4b97101f747e114253467ce4568cbced18f4c2d1. This patch is broken, cli->path refers to the absolute file, not the chunks, and it should check for this->state, not cli->state.
-rw-r--r--src/core.c25
1 files changed, 3 insertions, 22 deletions
diff --git a/src/core.c b/src/core.c
index 8caabec..113eb1e 100644
--- a/src/core.c
+++ b/src/core.c
@@ -352,21 +352,6 @@ void tip_client_pending(struct tip_client *cli)
cli->state = TIP_CLIENT_PENDING;
}
-static bool tip_direct_download_in_progress(const struct tip_client *cli)
-{
- struct tip_client *this;
-
- list_for_each_entry(this, &client_list, list) {
- if (cli->addr.sin_addr.s_addr == this->addr.sin_addr.s_addr)
- continue;
- if (cli->state != TIP_CLIENT_PENDING &&
- !strcmp(cli->path, this->path))
- return true;
- }
-
- return false;
-}
-
void tip_client_activate_pending(bool redirect_only)
{
struct tip_client *cli, *next;
@@ -376,13 +361,9 @@ void tip_client_activate_pending(bool redirect_only)
if (cli->state != TIP_CLIENT_PENDING)
continue;
redirected = tip_client_redirect(cli);
- if (!redirected) {
- if (redirect_only)
- continue;
- /* another client is fetching this file from server, skip. */
- if (tip_direct_download_in_progress(cli))
- continue;
- }
+ if (!redirected && redirect_only)
+ continue;
+
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);