* 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-861f7616d084master
parent
f17402ef40
commit
2dc1bcfd12
|
@ -86,7 +86,7 @@ class masterserver_connection:
|
|||
currentPlayers = _swap_endianness(currentPlayers)
|
||||
g = game(description, host, maxPlayers, currentPlayers)
|
||||
games.append(g)
|
||||
except socket.timeout:
|
||||
except (socket.error, socket.herror, socket.gaierror, socket.timeout):
|
||||
if allowException:
|
||||
raise
|
||||
|
||||
|
|
|
@ -119,8 +119,8 @@ class BotCommands:
|
|||
l = ["\x02%s\x02 [%i/%i]" % (g.description, g.currentPlayers, g.maxPlayers) for g in games]
|
||||
message += ", ".join(l)
|
||||
write("%s: %s" % (nick, message))
|
||||
except socket.timeout:
|
||||
write("%s: Failed to communicate with the lobby (%s:%d)" % (nick, self.bot.lobby.host, self.bot.lobby.port))
|
||||
except (socket.error, socket.herror, socket.gaierror, socket.timeout) as e:
|
||||
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
|
||||
|
||||
|
|
Loading…
Reference in New Issue