Browse code

core: allow listening on tls without listening on tcp

- reported in FS#425

Daniel-Constantin Mierla authored on 21/05/2014 07:55:46
Showing 2 changed files
... ...
@@ -1787,6 +1787,18 @@ static int calc_proc_no(void)
1787 1787
 			 tcp_e_listeners = tcp_cfg_children_no;
1788 1788
 	}
1789 1789
 	tcp_listeners += tcp_e_listeners;
1790
+#ifdef USE_TLS
1791
+	tcp_e_listeners = 0;
1792
+	for (si=tls_listen, tcp_listeners=0, tcp_e_listeners=0; si; si=si->next) {
1793
+		if(si->workers>0)
1794
+			tcp_listeners += si->workers;
1795
+		else {
1796
+			if(tcp_listeners==0)
1797
+				tcp_e_listeners = tcp_cfg_children_no;
1798
+		}
1799
+	}
1800
+	tcp_listeners += tcp_e_listeners;
1801
+#endif
1790 1802
 	tcp_children_no = tcp_listeners;
1791 1803
 #endif
1792 1804
 #ifdef USE_SCTP
... ...
@@ -4934,6 +4934,17 @@ int tcp_init_children()
4934 4934
 			}
4935 4935
 		}
4936 4936
 	}
4937
+#ifdef USE_TLS
4938
+	for(si=tls_listen; si; si=si->next) {
4939
+		if(si->workers>0) {
4940
+			si->workers_tcpidx = i - si->workers + 1;
4941
+			for(r=0; r<si->workers; r++) {
4942
+				tcp_children[i].mysocket = si;
4943
+				i--;
4944
+			}
4945
+		}
4946
+	}
4947
+#endif
4937 4948
 	tcp_sockets_gworkers = (i != tcp_children_no-1)?(1 + i + 1):0;
4938 4949
 
4939 4950
 	/* create the tcp sock_info structures */