diff options
author | tiptorrent development team <tiptorrent@soleta.eu> | 2022-02-08 11:58:53 +0100 |
---|---|---|
committer | tiptorrent development team <tiptorrent@soleta.eu> | 2022-02-08 12:09:39 +0100 |
commit | f6f3984be782e6c42a320081e00533fa30b45140 (patch) | |
tree | f7108649edf3d0f4f59793c06c681b6b966462c8 /src/core.c | |
parent | 28d7a25a89c458fcb3851dda2a97fbbc97acc3d7 (diff) |
allow to specify maximum number of redirections with -r
For example, -r/--redirect 3 specifies that the maximum number of redirections
per client is 3.
if -r/--redirect is specified with no argument, then the argument specified by
-n/--max-clients is used.
If -n/--max-clients is not specified and -r/--redirect is specifed with no
argument, then default value is 3.
Diffstat (limited to 'src/core.c')
-rw-r--r-- | src/core.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -222,7 +222,7 @@ int tip_client_redirect_create(const struct tip_client *cli) struct tip_client_redirect *redir; bool found = false; - if (!redirect || !cli->allow_redirect) + if (!max_redirect || !cli->allow_redirect) return 0; list_for_each_entry(redir, &client_redirect_list, list) { @@ -247,7 +247,7 @@ int tip_client_redirect_create(const struct tip_client *cli) redir->addr = cli->addr; redir->addr.sin_port = htons(9999); redir->uri = strdup(cli->uri); - redir->users = max_clients; + redir->users = max_redirect; list_add_tail(&redir->list, &client_redirect_list); ev_timer_init(&redir->timer, tip_client_redirect_timer_cb, TIP_CLIENT_REDIRECT_TIMEOUT, 0.); @@ -380,7 +380,7 @@ bool tip_client_redirect(struct tip_client *cli) struct tip_client_redirect *redir, *next; char addr[INET_ADDRSTRLEN + 1]; - if (!redirect) + if (!max_redirect) return false; inet_ntop(AF_INET, &cli->addr.sin_addr, addr, INET_ADDRSTRLEN); |