Selaa lähdekoodia

core: allow listening on tls without listening on tcp

- reported in FS#425
Daniel-Constantin Mierla 11 vuotta sitten
vanhempi
commit
eea7f9d040
2 muutettua tiedostoa jossa 23 lisäystä ja 0 poistoa
  1. 12 0
      main.c
  2. 11 0
      tcp_main.c

+ 12 - 0
main.c

@@ -1787,6 +1787,18 @@ static int calc_proc_no(void)
 			 tcp_e_listeners = tcp_cfg_children_no;
 			 tcp_e_listeners = tcp_cfg_children_no;
 	}
 	}
 	tcp_listeners += tcp_e_listeners;
 	tcp_listeners += tcp_e_listeners;
+#ifdef USE_TLS
+	tcp_e_listeners = 0;
+	for (si=tls_listen, tcp_listeners=0, tcp_e_listeners=0; si; si=si->next) {
+		if(si->workers>0)
+			tcp_listeners += si->workers;
+		else {
+			if(tcp_listeners==0)
+				tcp_e_listeners = tcp_cfg_children_no;
+		}
+	}
+	tcp_listeners += tcp_e_listeners;
+#endif
 	tcp_children_no = tcp_listeners;
 	tcp_children_no = tcp_listeners;
 #endif
 #endif
 #ifdef USE_SCTP
 #ifdef USE_SCTP

+ 11 - 0
tcp_main.c

@@ -4934,6 +4934,17 @@ int tcp_init_children()
 			}
 			}
 		}
 		}
 	}
 	}
+#ifdef USE_TLS
+	for(si=tls_listen; si; si=si->next) {
+		if(si->workers>0) {
+			si->workers_tcpidx = i - si->workers + 1;
+			for(r=0; r<si->workers; r++) {
+				tcp_children[i].mysocket = si;
+				i--;
+			}
+		}
+	}
+#endif
 	tcp_sockets_gworkers = (i != tcp_children_no-1)?(1 + i + 1):0;
 	tcp_sockets_gworkers = (i != tcp_children_no-1)?(1 + i + 1):0;
 
 
 	/* create the tcp sock_info structures */
 	/* create the tcp sock_info structures */