Partial implementation client resilience
This commit is contained in:
@@ -3,8 +3,10 @@ package it.polimi.ingsw.gc14;
|
||||
|
||||
import it.polimi.ingsw.gc14.Controller.GameController;
|
||||
import it.polimi.ingsw.gc14.Model.Game;
|
||||
import it.polimi.ingsw.gc14.Model.Player;
|
||||
import it.polimi.ingsw.gc14.Network.ClientPlayer;
|
||||
import it.polimi.ingsw.gc14.Network.NetworkEvent;
|
||||
import it.polimi.ingsw.gc14.Network.NetworkEvents.SkipPlayerDisconnected;
|
||||
import it.polimi.ingsw.gc14.Network.RMI.Server.RMIServer;
|
||||
import it.polimi.ingsw.gc14.Network.TCP.Server.TCPServer;
|
||||
import it.polimi.ingsw.gc14.View.TUI.TUI;
|
||||
@@ -85,13 +87,16 @@ public class ServerLauncher {
|
||||
* @throws RemoteException if an RMI error occurs
|
||||
*/
|
||||
public boolean doFirstEvent() throws InterruptedException, RemoteException {
|
||||
NetworkEvent event = actionQueue.take();
|
||||
event.setIsError(!event.apply(gameController));
|
||||
|
||||
serverRMI.notifyAll(event);
|
||||
serverTCP.notifyAll(event);
|
||||
|
||||
return !event.getIsError();
|
||||
synchronized (gameController) {
|
||||
NetworkEvent event = actionQueue.take();
|
||||
event.setIsError(!event.apply(gameController));
|
||||
serverRMI.notifyAll(event);
|
||||
serverTCP.notifyAll(event);
|
||||
if (!playerList.get(gameController.getModel().getCurrentState().getCurrentPlayer().getUserName())) {
|
||||
actionQueue.offer(new SkipPlayerDisconnected(gameController.getModel().getCurrentState().getCurrentPlayer().getUserName()));
|
||||
}
|
||||
return !event.getIsError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user