Shutdown private server when room is abandoned
authorunc0rr
Mon, 20 Oct 2008 18:51:43 +0000
changeset 1385 ca72264f921a
parent 1384 329d3308e2e3
child 1386 674429128152
Shutdown private server when room is abandoned
QTfrontend/newnetclient.cpp
netserver/HWProto.hs
netserver/hedgewars-server.hs
--- a/QTfrontend/newnetclient.cpp	Mon Oct 20 18:35:36 2008 +0000
+++ b/QTfrontend/newnetclient.cpp	Mon Oct 20 18:51:43 2008 +0000
@@ -184,7 +184,7 @@
 
 void HWNewNet::ParseCmd(const QStringList & lst)
 {
-	qDebug() << "Server: " << lst;
+	//qDebug() << "Server: " << lst;
 
 	if(!lst.size())
 	{
--- a/netserver/HWProto.hs	Mon Oct 20 18:35:36 2008 +0000
+++ b/netserver/HWProto.hs	Mon Oct 20 18:51:43 2008 +0000
@@ -14,7 +14,7 @@
 
 answerServerMessage = [(clientOnly, "SERVER_MESSAGE" : [body])]
 	where
-		body = serverMessage globalOptions ++ if isDedicated globalOptions then "" else "<p align=center>Private server</p>"
+		body = serverMessage globalOptions ++ if isDedicated globalOptions then "<p align=center>Dedicated server</p>" else "<p align=center>Private server</p>"
 answerBadCmd = [(clientOnly, ["ERROR", "Bad command, state or incorrect parameter"])]
 answerNotMaster = [(clientOnly, ["ERROR", "You cannot configure room parameters"])]
 answerBadParam = [(clientOnly, ["ERROR", "Bad parameter"])]
--- a/netserver/hedgewars-server.hs	Mon Oct 20 18:35:36 2008 +0000
+++ b/netserver/hedgewars-server.hs	Mon Oct 20 18:51:43 2008 +0000
@@ -77,7 +77,9 @@
 
 			clientsIn <- sendAnswers answers mclient mclients mrooms
 			
-			when ((isDedicated globalOptions) || (not $ null clientsIn)) $ mainLoop servSock acceptChan clientsIn mrooms
+			let hadRooms = (not $ null rooms) && (null mrooms)
+				in unless ((not $ isDedicated globalOptions) && ((null clientsIn) || hadRooms)) $
+					mainLoop servSock acceptChan clientsIn mrooms
 
 
 startServer serverSocket = do