* Catch and handle all socket errors, not just timeouts

- Don't just report failure to the user that request a lobby listing, report the error message (asociated with the exception) as well


git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7123 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2009-04-22 08:37:06 +00:00 committed by Git SVN Gateway
parent f17402ef40
commit 2dc1bcfd12
2 changed files with 3 additions and 3 deletions

View File

@ -86,7 +86,7 @@ class masterserver_connection:
currentPlayers = _swap_endianness(currentPlayers) currentPlayers = _swap_endianness(currentPlayers)
g = game(description, host, maxPlayers, currentPlayers) g = game(description, host, maxPlayers, currentPlayers)
games.append(g) games.append(g)
except socket.timeout: except (socket.error, socket.herror, socket.gaierror, socket.timeout):
if allowException: if allowException:
raise raise

View File

@ -119,8 +119,8 @@ class BotCommands:
l = ["\x02%s\x02 [%i/%i]" % (g.description, g.currentPlayers, g.maxPlayers) for g in games] l = ["\x02%s\x02 [%i/%i]" % (g.description, g.currentPlayers, g.maxPlayers) for g in games]
message += ", ".join(l) message += ", ".join(l)
write("%s: %s" % (nick, message)) write("%s: %s" % (nick, message))
except socket.timeout: except (socket.error, socket.herror, socket.gaierror, socket.timeout) as e:
write("%s: Failed to communicate with the lobby (%s:%d)" % (nick, self.bot.lobby.host, self.bot.lobby.port)) write("%s: Failed to communicate with the lobby (%s:%d): %s" % (nick, self.bot.lobby.host, self.bot.lobby.port, e))
# TODO: if message.startswith("show") # join a game and show information about it # TODO: if message.startswith("show") # join a game and show information about it