mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Terminating client thread before server thread to prevent alert box popping up
This commit is contained in:
@@ -157,14 +157,12 @@ public class ClientToServerThread implements Runnable {
|
|||||||
} catch (ByteReadException e) {
|
} catch (ByteReadException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSocket();
|
closeSocket();
|
||||||
if (Platform.isFxApplicationThread()) {
|
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
Alert alert = new Alert(AlertType.ERROR);
|
Alert alert = new Alert(AlertType.ERROR);
|
||||||
alert.setHeaderText("Host has disconnected");
|
alert.setHeaderText("Host has disconnected");
|
||||||
alert.setContentText("Cannot find Server");
|
alert.setContentText("Cannot find Server");
|
||||||
alert.showAndWait();
|
alert.showAndWait();
|
||||||
});
|
});
|
||||||
}
|
|
||||||
clientLog(e.getMessage(), 1);
|
clientLog(e.getMessage(), 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,8 +71,8 @@ public class RegularPacketsTest {
|
|||||||
|
|
||||||
@After
|
@After
|
||||||
public void teardown () throws Exception {
|
public void teardown () throws Exception {
|
||||||
serverThread.terminate();
|
|
||||||
clientThread.setSocketToClose();
|
clientThread.setSocketToClose();
|
||||||
|
serverThread.terminate();
|
||||||
GameState.setCurrentStage(GameStages.LOBBYING);
|
GameState.setCurrentStage(GameStages.LOBBYING);
|
||||||
for (int i = 0; i<20; i++)
|
for (int i = 0; i<20; i++)
|
||||||
SleepThreadMaxDelay(); //Make sure socket is closed and toolkit remade.
|
SleepThreadMaxDelay(); //Make sure socket is closed and toolkit remade.
|
||||||
|
|||||||
Reference in New Issue
Block a user