~widelands-dev/widelands-website/trunk

« back to all changes in this revision

Viewing changes to wlms/protocol.py

  • Committer: Holger Rapp
  • Date: 2012-02-14 06:32:50 UTC
  • Revision ID: sirver@gmx.de-20120214063250-oaovpw7osjkl4bg1
Fixed a rare condition when we could receive a game ping from a game we know nothing about

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
            self._fac.no_reply()
69
69
            return
70
70
 
71
 
        game = self._client_protocol._ms.games[self._client_protocol._game]
 
71
        game = self._client_protocol._ms.games.get(self._client_protocol._game, None)
 
72
        # This could be a game ping for a game that has been ended and a new
 
73
        # one has already started. If we know nothing about the game, ignore
 
74
        # this silently.
 
75
        if game is None:
 
76
            return
 
77
 
72
78
        if game.state == "ping_pending": # Game is valid. Let's go
73
79
            game.state = "accepting_connections"
74
80
            self._client_protocol.send("GAME_OPEN")