Skip to content

Commit

Permalink
add check for null input to handle client disconnection (#214)
Browse files Browse the repository at this point in the history
  • Loading branch information
kappsegla committed Feb 14, 2024
2 parents 7d6601d + aa34821 commit df5635c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main/java/org/fungover/haze/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import java.util.List;



public class Main {
static boolean serverOpen = true;
static Logger logger = LogManager.getLogger(Main.class);
Expand Down Expand Up @@ -50,7 +49,13 @@ public static void main(String[] args) {

String firstReading = input.readLine();

readInputStream(input,inputList,firstReading);
if (firstReading == null) {
logger.info("client has closed the connection");
client.close();
return;
}

readInputStream(input, inputList, firstReading);

clientAuthenticated = Auth.authenticateClient(auth, isPasswordSet, client, inputList, clientAuthenticated);

Expand Down

0 comments on commit df5635c

Please sign in to comment.