Skip to content

Commit

Permalink
Cap TCP workers at tcp_workers_max_no
Browse files Browse the repository at this point in the history
  • Loading branch information
James Stanley committed Mar 17, 2023
1 parent 5ba4ddb commit 0dc8fc8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
9 changes: 6 additions & 3 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ int main(int argc, char** argv)
int ret;
unsigned int seed;
int rfd;
int want_tcp_workers_no;

/*init*/
ret=-1;
Expand Down Expand Up @@ -764,10 +765,12 @@ int main(int argc, char** argv)
}
}
if (tcp_count_processes(NULL)!=0) {
if (tcp_workers_no>2) {
LM_NOTICE("setting TCP children to 2 (found %d)\n",
want_tcp_workers_no = (tcp_workers_max_no>=2) ? 2 : tcp_workers_max_no;
if (tcp_workers_no != want_tcp_workers_no) {
LM_NOTICE("setting TCP children to %d (found %d)\n",
want_tcp_workers_no,
tcp_workers_no);
tcp_workers_no = 2;
tcp_workers_no = want_tcp_workers_no;
}
}

Expand Down
5 changes: 0 additions & 5 deletions net/net_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2014,11 +2014,6 @@ int tcp_start_processes(int *chd_rank, int *startup_done)
if (tcp_disabled)
return 0;

if (tcp_workers_no > tcp_workers_max_no)
LM_BUG("can't run more TCP workers than the amount we allocated memory for: "
"tcp_workers_no=%d > tcp_workers_max_no=%d",
tcp_workers_no, tcp_workers_max_no);

/* estimate max fd. no:
* 1 tcp send unix socket/all_proc,
* + 1 udp sock/udp proc + 1 tcp_worker sock/tcp worker*
Expand Down

0 comments on commit 0dc8fc8

Please sign in to comment.