Close main socket before SSL init, to prevent hangs (I hope)
authorJamie Cameron <jcameron@webmin.com>
Tue, 28 Jun 2011 04:07:23 +0000 (00:07 -0400)
committerJamie Cameron <jcameron@webmin.com>
Tue, 28 Jun 2011 04:07:23 +0000 (00:07 -0400)
miniserv.pl

index 8c95226..24081f8 100755 (executable)
@@ -879,13 +879,6 @@ while(1) {
                                $SIG{'HUP'} = 'IGNORE';
                                $SIG{'USR1'} = 'IGNORE';
 
-                               # Initialize SSL for this connection
-                               if ($use_ssl) {
-                                       $ssl_con = &ssl_connection_for_ip(
-                                                       SOCK, $ipv6fhs{$s});
-                                       $ssl_con || exit;
-                                       }
-
                                # Close the file handle for the session DBM
                                dbmclose(%sessiondb);
 
@@ -897,6 +890,13 @@ while(1) {
                                &close_all_sockets();
                                close(LISTEN);
 
+                               # Initialize SSL for this connection
+                               if ($use_ssl) {
+                                       $ssl_con = &ssl_connection_for_ip(
+                                                       SOCK, $ipv6fhs{$s});
+                                       $ssl_con || exit;
+                                       }
+
                                print DEBUG
                                  "main: Starting handle_request loop pid=$$\n";
                                while(&handle_request($peera, $locala,