Fixed most of issue #19 with new master?

This commit is contained in:
David Wu
2017-08-17 13:49:43 +12:00
parent fa5992bfb2
commit c08bafa566
16 changed files with 98 additions and 43 deletions
@@ -37,6 +37,8 @@ public class ConnectionAcceptor implements Runnable {
*/
private ServerSocket serverSocket;
private Socket mockSocket = null;
/**
* List of client connections.
@@ -114,7 +116,7 @@ public class ConnectionAcceptor implements Runnable {
* Run the Acceptor
*/
@Override
public void run() {
public void run(){
while(clientConnections.remainingCapacity() > 0) {
@@ -124,7 +126,9 @@ public class ConnectionAcceptor implements Runnable {
break;
}
Socket mockSocket = serverSocket.accept();
try {
this.mockSocket = serverSocket.accept();
} catch (Exception e){}
Logger.getGlobal().log(Level.INFO, String.format("Client connected. client ip/port = %s. Local ip/port = %s.", mockSocket.getRemoteSocketAddress(), mockSocket.getLocalSocketAddress()));
@@ -157,9 +157,9 @@ public class Event {
}
public void endEvent() throws IOException {
this.connectionThread.interrupt();
this.connectionAcceptor.closeConnection();
this.raceThread.interrupt();
this.connectionThread.interrupt();
this.connectionAcceptor.closeConnection();
this.raceThread.interrupt();
}
@@ -103,6 +103,8 @@ public class MockOutput implements RunnableWithFramePeriod {
Logger.getGlobal().log(Level.WARNING, "MockOutput.run() interrupted while putting message in queue.", e);
Thread.currentThread().interrupt();
return;
} catch (Exception e) {
e.printStackTrace();
}
}