Merge 0.10->trunk
[prosody.git] / net / server_select.lua
index 35dcb5a75cc336de133cc043d772e400ae3c1a61..4df6e12d750ce2ce15ef6a719e4308792a5ac2f8 100644 (file)
@@ -580,8 +580,9 @@ wrapconnection = function( server, listeners, socket, ip, serverport, clientport
                                                coroutine_yield( ) -- handshake not finished
                                        end
                                end
-                               out_put( "server.lua: ssl handshake error: ", tostring(err or "handshake too long") )
-                               _ = handler and handler:force_close("ssl handshake failed")
+                               err = "ssl handshake error: " .. ( err or "handshake too long" );
+                               out_put( "server.lua: ", err );
+                               _ = handler and handler:force_close(err)
                                return false, err -- handshake failed
                        end
                )
@@ -934,6 +935,7 @@ loop = function(once) -- this is the main loop of the program
                end
        until quitting;
        if once and quitting == "once" then quitting = nil; return; end
+       closeall();
        return "quitting"
 end