Skip to content

Commit

Permalink
Fix bug on closing GPGNet socket right away
Browse files Browse the repository at this point in the history
  • Loading branch information
Brutus5000 committed Dec 8, 2024
1 parent 1cb14d2 commit 0082f26
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,11 @@ private void onGpgnetConnectionLost() {
private void acceptThread() {
while (!Thread.currentThread().isInterrupted()) {
log.info("Listening for incoming connections from game");
try (Socket socket = serverSocket.accept()) {
try {
// The socket declaration must not be moved into a try-with-resources block, as the socket must not be
// closed. It is passed into the GPGNetClient.
Socket socket = serverSocket.accept();

LockUtil.executeWithLock(lockSocket, () -> {
if (currentClient != null) {
onGpgnetConnectionLost();
Expand Down

0 comments on commit 0082f26

Please sign in to comment.