Skip to content

Commit

Permalink
[TCP] fix init TCP support for auto-scalled procs
Browse files Browse the repository at this point in the history
When starting the TCP Main proc, be sure we initialize the MAIN<>Worker communication sockets also for the procs to be potentially scaled in the future.
`pt[n].unix_sock` is valid only for running procs (not for the "autoscale to-be"), so use the `pt[n].tcp_socks_holder[0]` holder (valid for all procs, running or not).
Thanks go to Yury Kirsanov and Slava Bendersky for reporting and helping with the troubleshooting.
  • Loading branch information
bogdan-iancu committed Sep 16, 2022
1 parent 994e55c commit d7a4bf8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/net_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1652,13 +1652,13 @@ static void tcp_main_server(void)
* processes (get fd, new connection a.s.o)
* NOTE: we add even the socks for the inactive/unfork processes - the
* socks are already created, but the triggering is from proc to
* main, having them into reactor is harmless - thye will never
* main, having them into reactor is harmless - they will never
* trigger as there is no proc on the other end to write us */
for (n=1; n<counted_max_processes; n++) {
/* skip myslef (as process) and -1 socks (disabled)
(we can't have 0, we never close it!) */
if (n!=process_no && pt[n].unix_sock>0)
if (reactor_add_reader( pt[n].unix_sock, F_TCP_WORKER,
if (n!=process_no && pt[n].tcp_socks_holder[0]>0)
if (reactor_add_reader( pt[n].tcp_socks_holder[0], F_TCP_WORKER,
RCT_PRIO_PROC, &pt[n])<0){
LM_ERR("failed to add process %d (%s) unix socket "
"to the fd list\n", n, pt[n].desc);
Expand Down

0 comments on commit d7a4bf8

Please sign in to comment.