Browse Source

Remove decrease of listen backlog which is of questionable utility

master
Con Kolivas 10 years ago
parent
commit
83b23d864f
  1. 13
      src/connector.c

13
src/connector.c

@ -453,10 +453,8 @@ static client_instance_t *ref_client_by_id(cdata_t *cdata, int64_t id)
void *receiver(void *arg)
{
cdata_t *cdata = (cdata_t *)arg;
bool dropped_backlog = false;
struct epoll_event event;
uint64_t serverfds, i;
time_t start_t;
int ret, epfd;
rename_proc("creceiver");
@ -481,21 +479,10 @@ void *receiver(void *arg)
while (!cdata->accept)
cksleep_ms(1);
start_t = time(NULL);
while (42) {
client_instance_t *client;
if (unlikely(!dropped_backlog && time(NULL) - start_t > 90)) {
/* When we first start we listen to as many connections
* as possible. After the first minute we drop the
* listen to the minimum to effectively ratelimit how
* fast we can receive new connections. */
dropped_backlog = true;
LOGNOTICE("Dropping server listen backlog to 0");
for (i = 0; i < serverfds; i++)
listen(cdata->serverfd[i], 0);
}
while (unlikely(!cdata->accept))
cksleep_ms(10);
ret = epoll_wait(epfd, &event, 1, 1000);

Loading…
Cancel
Save