Better debug output

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4386 4a71c877-e1ca-e34f-864e-861f7616d084
master
Dennis Schridde 2008-03-28 12:08:13 +00:00
parent 40a2257a31
commit 7a688bdf45
1 changed files with 4 additions and 4 deletions

View File

@ -158,13 +158,13 @@ class Game:
# Check we can connect to the host # Check we can connect to the host
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try: try:
logging.debug("(%s) Checking gameserver's vitality..." % self.host) logging.debug("Checking %s's vitality..." % self.host)
s.settimeout(10.0) s.settimeout(10.0)
s.connect((self.host, gamePort)) s.connect((self.host, gamePort))
s.close() s.close()
return True return True
except: except:
logging.debug("(%s) Gameserver did not respond!" % self.host) logging.debug("%s did not respond!" % self.host)
return False return False
# #
@ -241,7 +241,7 @@ class RequestHandler(SocketServer.ThreadingMixIn, SocketServer.StreamRequestHand
# Lock the gamelist to prevent new games while output. # Lock the gamelist to prevent new games while output.
with gamedblock: with gamedblock:
gamesCount = len(gamedb.getGames()) gamesCount = len(gamedb.getGames())
logging.debug("Gameserver list: %i game(s)" % (gamesCount)) logging.debug("(%s) Gameserver list: %i game(s)" % (gameHost, gamesCount))
# Transmit the length of the following list as unsigned integer (in network byte-order: big-endian). # Transmit the length of the following list as unsigned integer (in network byte-order: big-endian).
count = struct.pack('!I', gamesCount) count = struct.pack('!I', gamesCount)
@ -254,7 +254,7 @@ class RequestHandler(SocketServer.ThreadingMixIn, SocketServer.StreamRequestHand
# If something unknown apperas. # If something unknown apperas.
else: else:
raise Exception("Recieved a unknown command: %s" % netCommand) raise Exception("(%s) Recieved a unknown command: %s" % (gameHost, netCommand))
# #
################################################################################ ################################################################################