Linked table to show games from received packets. #story[1188]

main
Joseph 9 years ago
parent f8e1a539c2
commit f1c07bca46

@ -19,6 +19,7 @@ public class MatchBrowserLobbyInterface extends Observable {
private DatagramSocket socket; private DatagramSocket socket;
private MatchBrowserClientRunnable clientRunnable; private MatchBrowserClientRunnable clientRunnable;
private List<HostGame> games = new ArrayList<>(); private List<HostGame> games = new ArrayList<>();
private Thread clientRunnableThread;
public MatchBrowserLobbyInterface() { public MatchBrowserLobbyInterface() {
@ -30,7 +31,7 @@ public class MatchBrowserLobbyInterface extends Observable {
public void startReceivingHostData(DatagramSocket socket) { public void startReceivingHostData(DatagramSocket socket) {
this.socket = socket; this.socket = socket;
clientRunnable = new MatchBrowserClientRunnable(this, socket); clientRunnable = new MatchBrowserClientRunnable(this, socket);
Thread clientRunnableThread = new Thread(clientRunnable, "Socket: " + socket.toString()); clientRunnableThread = new Thread(clientRunnable, "Socket: " + socket.toString());
clientRunnableThread.start(); clientRunnableThread.start();
} }
@ -61,9 +62,10 @@ public class MatchBrowserLobbyInterface extends Observable {
} }
/** /**
* Used to close the socket once out of the lobby * Used to close the socket and runnable once out of the lobby
*/ */
public void closeSocket() { public void closeSocket() {
clientRunnableThread.interrupt();
this.socket.close(); this.socket.close();
} }
} }

Loading…
Cancel
Save