Skip to content
Snippets Groups Projects
Commit d338704f authored by Daniel Salzman's avatar Daniel Salzman
Browse files

ctl: increase listen backlog to 5

When a control client reaches its timeout or is interrupted, the connection isn't
closed by the server immediately. So another connection attempts can be forbiden
with the error "OS lacked necessary resources". By increasing the listen backlog
such a situation is less probable to happen.
parent 793a5f8e
No related branches found
No related tags found
No related merge requests found
Pipeline #62725 passed
/* Copyright (C) 2019 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
/* Copyright (C) 2020 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -36,6 +36,9 @@
#define CTL_BUFF_SIZE (256 * 1024)
#endif
/*! Listen backlog size. */
#define LISTEN_BACKLOG 5
/*! Default socket operations timeout in milliseconds. */
#define DEFAULT_TIMEOUT (5 * 1000)
......@@ -208,7 +211,7 @@ int knot_ctl_bind(knot_ctl_t *ctx, const char *path)
}
// Start listening.
if (listen(ctx->listen_sock, 1) != 0) {
if (listen(ctx->listen_sock, LISTEN_BACKLOG) != 0) {
close_sock(&ctx->listen_sock);
return knot_map_errno();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment