Fixed some small server issues. Players in the process of establishing a session are now kicked on game start.

If someone tries to join a game which is already running, a proper error message is shown.
When sending a message to all or all but one players, the players which do not have the session established are now correctly ignored.
This commit is contained in:
lotodore
2007-05-23 08:57:34 +00:00
parent e8cbac12cc
commit e01ea96727
3 changed files with 121 additions and 49 deletions
+4
View File
@@ -83,6 +83,7 @@ protected:
typedef std::deque<boost::shared_ptr<ConnectData> > ConnectQueue;
typedef std::map<SOCKET, SessionWrapper> SocketSessionMap;
typedef std::list<SessionWrapper> SessionList;
typedef std::deque<Notification> NotificationQueue;
typedef std::list<std::pair<boost::microsec_timer, boost::shared_ptr<SessionData> > > CloseSessionList;
@@ -102,7 +103,9 @@ protected:
SessionWrapper GetSession(SOCKET sock);
void AddSession(boost::shared_ptr<SessionData> sessionData); // new Sessions have no player data
void SessionError(SessionWrapper session, int errorCode);
void RejectNewConnection(boost::shared_ptr<ConnectData> connData);
void CloseSessionDelayed(SessionWrapper session);
void RemoveNotEstablishedSessions();
size_t GetCurNumberOfPlayers() const;
bool IsPlayerConnected(const std::string &playerName) const;
@@ -163,6 +166,7 @@ friend class ServerRecvStateInit;
friend class ServerRecvStateStartGame;
friend class ServerRecvStateStartHand;
friend class ServerRecvStateStartRound;
friend class ServerRecvStateFinal;
};
#endif