Some work to try prevent stack memory leak
authorunc0rr
Sun, 19 Apr 2009 11:40:41 +0000
changeset 2004 f7944d5adc5f
parent 2003 41b3d00949ca
child 2005 aa79f631711b
Some work to try prevent stack memory leak
gameServer/CoreTypes.hs
gameServer/NetRoutines.hs
--- a/gameServer/CoreTypes.hs	Sat Apr 18 12:46:56 2009 +0000
+++ b/gameServer/CoreTypes.hs	Sun Apr 19 11:40:41 2009 +0000
@@ -15,7 +15,7 @@
 data ClientInfo =
  ClientInfo
 	{
-		clientUID :: Int,
+		clientUID :: !Int,
 		sendChan :: Chan [String],
 		clientHandle :: Handle,
 		host :: String,
@@ -23,18 +23,18 @@
 		nick :: String,
 		webPassword :: String,
 		logonPassed :: Bool,
-		clientProto :: Word16,
-		roomID :: Int,
-		pingsQueue :: Word,
+		clientProto :: !Word16,
+		roomID :: !Int,
+		pingsQueue :: !Word,
 		isMaster :: Bool,
 		isReady :: Bool,
-		isAdministrator :: Bool,
-		forceQuit :: Bool,
-		partRoom :: Bool
+		isAdministrator :: Bool
 	}
 
 instance Show ClientInfo where
-	show ci = show $ clientUID ci
+	show ci = (show $ clientUID ci)
+			++ " nick: " ++ (nick ci)
+			++ " host: " ++ (host ci)
 
 instance Eq ClientInfo where
 	a1 == a2 = clientHandle a1 == clientHandle a2
@@ -59,14 +59,14 @@
 data RoomInfo =
 	RoomInfo
 	{
-		roomUID :: Int,
+		roomUID :: !Int,
 		name :: String,
 		password :: String,
 		roomProto :: Word16,
 		teams :: [TeamInfo],
 		gameinprogress :: Bool,
 		playersIn :: !Int,
-		readyPlayers :: Int,
+		readyPlayers :: !Int,
 		playersIDs :: IntSet.IntSet,
 		isRestrictedJoins :: Bool,
 		isRestrictedTeams :: Bool,
@@ -118,7 +118,6 @@
 		serverMessage :: String,
 		serverMessageForOldVersions :: String,
 		listenPort :: PortNumber,
-		loginsNumber :: Int,
 		nextRoomID :: Int,
 		dbHost :: String,
 		dbLogin :: String,
@@ -130,7 +129,7 @@
 	}
 
 instance Show ServerInfo where
-	show si = "Logins: " ++ (show $ loginsNumber si)
+	show si = "Server Info"
 
 newServerInfo = (
 	ServerInfo
@@ -139,7 +138,6 @@
 		"<font color=yellow><h3>Hedgewars 0.9.10 is out! Please, update. Support for previous versions IS DROPPED</h3><p align=center><a href=http://hedgewars.org/download.html>Download page here</a></p><h4>New features are:</h4><ul><li>Large maps</li><li>New game options</li><li>Utilities</li><li>...</li></ul></font>"
 		46631
 		0
-		0
 		""
 		""
 		""
--- a/gameServer/NetRoutines.hs	Sat Apr 18 12:46:56 2009 +0000
+++ b/gameServer/NetRoutines.hs	Sun Apr 19 11:40:41 2009 +0000
@@ -45,8 +45,6 @@
 					False
 					False
 					False
-					False
-					False
 					)
 
 		writeChan coreChan $ Accept newClient