private void ProccessIncomingSession(NotifySessionBeginAppServerPacket obj) { var simulatedGame = new SimulatedGameSession(obj.Session); ActiveGameSessions.Add(simulatedGame); _routingTable.Remove(obj.Sender); // Log the event that this session begun Logger.Instance.Log(Level.Info, "Session " + simulatedGame.Session.SessionID + ":" + " Started a simulation job on this application server."); simulatedGame.SessionEnded += SimulatedGame_SessionEnded; }
private void CheckCompletion(GameSession gameSession) { if (!gameSession.IsFull || gameSession.InProgress) { return; } // We wait, and then tell everyone it's OK to enter again //Sessions.Remove(gameSession); gameSession.InProgress = true; // We generate a secure token for each user foreach (var cUser in gameSession.Users) { cUser.SecureToken = Guid.NewGuid(); //TODO: Take this parameter from the client // We should also validate it's even legal as it comes from the client cUser.SessionConfig = new UserSessionConfig("FemaleSheet1"); } #if DEBUG_MOCK foreach (var cUser in gameSession.Users) { cUser.SecureToken = Guid.Empty; } #endif var appServerService = (AppServerService)ServiceContainer.GetService(typeof(AppServerService)); var server = appServerService.GetAvailableServer(); // Notify the app server var appServerNotifyPacket = new NotifySessionBeginAppServerPacket(gameSession); ClientNetworkManager.Instance.SendPacket(appServerNotifyPacket, server.Connection); var endpointInfo = server.Connection.RemoteEndpoint.ToString(); //endpointInfo = "99.235.224.52:7798"; // We generate a secure token for each user foreach (var cUser in gameSession.Users) { var packet = new SessionBeginNotificationPacket(cUser.SecureToken, endpointInfo, gameSession.SessionID); ClientNetworkManager.Instance.SendPacket(packet, cUser.Connection); } Logger.Instance.Log(Level.Info, "The match " + gameSession + " is now underway."); Logger.Instance.Log(Level.Info, "The simulation is being completed on: " + server.Name); }