core: allow listening on tls without listening on tcp
authorDaniel-Constantin Mierla <miconda@gmail.com>
Wed, 21 May 2014 07:55:46 +0000 (09:55 +0200)
committerDaniel-Constantin Mierla <miconda@gmail.com>
Wed, 21 May 2014 07:56:33 +0000 (09:56 +0200)
- reported in FS#425

main.c
tcp_main.c

diff --git a/main.c b/main.c
index 89115a4..bcfcf9f 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1787,6 +1787,18 @@ static int calc_proc_no(void)
                         tcp_e_listeners = tcp_cfg_children_no;
        }
        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;
 #endif
 #ifdef USE_SCTP
index 701f90f..5a43d2c 100644 (file)
@@ -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;
 
        /* create the tcp sock_info structures */