Minor documentation inputs / changes

This commit is contained in:
Alexander Sazonov 2022-03-28 03:29:49 +02:00
parent fd8ee64e50
commit 69219bc120
3 changed files with 5 additions and 12 deletions

View File

@ -110,7 +110,6 @@ public class Client {
public void closeEverything(Socket socket, BufferedReader in, BufferedWriter out) {
//TODO Correctly closing a clients connection
// Is this not already correct?
try {
if (in != null) {
in.close();

View File

@ -126,8 +126,6 @@ public class ClientHandler implements Runnable {
}
}
//TODO: Documentation
/** Sends a given message to client
*
* @param msg the given message

View File

@ -30,17 +30,13 @@ public class Server {
connectedClients.add(nextClient);
th.start();
// close socket + remove client if client is disconnected
if (socket.getInputStream().read() == -1) {
/* TODO: Modify or remove this disconnection handling - right now, it is not functioning
(when disconnecting there are "broken pipe" exceptions on client side and "stream closed"
exceptions on the server side).
*/
if (nextClient.getSocket().getInputStream().read() == -1) {
System.out.println("client disconnected. closing socket");
socket.close();
connectedClients.remove(nextClient);
}
// close socket + remove client if client is disconnected
if (socket.getInputStream().read() == -1) {
System.out.println("client disconnected. closing socket");
socket.close();
connectedClients.remove(nextClient);
}
}
} catch (IOException e) {