private ServerSocket serverSocket;\r
// Set to true once the server is established\r
private boolean isServer = false;\r
- \r
+ // Set to false when server is shutting down\r
+ private boolean isAlive= true;\r
private SocketManager manager;\r
\r
/**\r
// Loop forever, accepting connectons from other clients\r
// TODO: add in the ability to terminate the server if a VAMSAS session\r
// is ended\r
- while (true)\r
+ while (isAlive)\r
{\r
try\r
{\r
Socket socket = serverSocket.accept(); \r
logger.info("SERVER: connection detected");\r
- \r
- manager.addEndPoint(socket);\r
+ if (isAlive)\r
+ manager.addEndPoint(socket);\r
}\r
catch (IOException e) {}\r
}\r
void terminate()\r
{\r
logger.info("Server shutting down...");\r
- \r
+ isAlive=false;\r
try { serverSocket.close(); }\r
catch (Exception e)\r
{\r