Server now closes correctly when host is leaving
This commit is contained in:
		@@ -204,7 +204,7 @@ public void enter(MdgaState state) {
 | 
				
			|||||||
        switch (state) {
 | 
					        switch (state) {
 | 
				
			||||||
            case MAIN:
 | 
					            case MAIN:
 | 
				
			||||||
                view = mainView;
 | 
					                view = mainView;
 | 
				
			||||||
                clientGameLogic.clear();
 | 
					                clientGameLogic = new ClientGameLogic(networkConnection);
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            case LOBBY:
 | 
					            case LOBBY:
 | 
				
			||||||
                view = lobbyView;
 | 
					                view = lobbyView;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -285,6 +285,7 @@ public void handleDisconnect(int id) {
 | 
				
			|||||||
    public void exit() {
 | 
					    public void exit() {
 | 
				
			||||||
        LOGGER.log(Level.INFO, "Requesting server shutdown"); //NON-NLS
 | 
					        LOGGER.log(Level.INFO, "Requesting server shutdown"); //NON-NLS
 | 
				
			||||||
        running = false;
 | 
					        running = false;
 | 
				
			||||||
 | 
					        pendingMessages.add(new ReceivedMessage(new AnimationEndMessage(), -1));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,9 +50,8 @@ public void exit() {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void selectLeave() {
 | 
					    public void selectLeave() {
 | 
				
			||||||
        parent.setState(parent.getStartDialog());
 | 
					 | 
				
			||||||
        logic.addNotification(new StartDialogNotification());
 | 
					 | 
				
			||||||
        logic.send(new LeaveGameMessage());
 | 
					        logic.send(new LeaveGameMessage());
 | 
				
			||||||
 | 
					        logic.addNotification(new StartDialogNotification());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user