activate pending clients only for large files
small files should not activate pending clients, otherwise max_clients is not fulfilled.master
parent
1b890bd11b
commit
b07785d2d1
|
@ -47,10 +47,12 @@ static void tip_client_release(struct ev_loop *loop, struct tip_client *cli)
|
|||
|
||||
free((void *)cli->uri);
|
||||
free((void *)cli->path);
|
||||
free(cli);
|
||||
num_clients--;
|
||||
|
||||
tip_client_activate_pending();
|
||||
if (tip_client_large_file(cli))
|
||||
tip_client_activate_pending();
|
||||
|
||||
free(cli);
|
||||
}
|
||||
|
||||
static int tip_client_payload_too_large(struct tip_client *cli)
|
||||
|
|
|
@ -55,6 +55,11 @@ static inline int tip_client_socket(const struct tip_client *cli)
|
|||
return cli->io.fd;
|
||||
}
|
||||
|
||||
static inline bool tip_client_large_file(const struct tip_client *cli)
|
||||
{
|
||||
return cli->size > FILE_SIZE_THRESHOLD;
|
||||
}
|
||||
|
||||
void tip_client_pending(struct tip_client *cli);
|
||||
bool tip_client_redirect(struct tip_client *cli);
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ int tip_client_state_process_payload(struct tip_client *cli)
|
|||
cli->allow_redirect = allow_redirect;
|
||||
|
||||
num_clients++;
|
||||
if (cli->size > FILE_SIZE_THRESHOLD && num_clients > max_clients) {
|
||||
if (tip_client_large_file(cli) && num_clients > max_clients) {
|
||||
if (!tip_client_redirect(cli)) {
|
||||
tip_client_pending(cli);
|
||||
return 1;
|
||||
|
|
Loading…
Reference in New Issue