Skip to content

Commit

Permalink
Don't let locks pile up
Browse files Browse the repository at this point in the history
  • Loading branch information
Mindgamesnl committed May 6, 2024
1 parent 77a978d commit 84fee7f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion plugin/src/main/bash/data.bin
Original file line number Diff line number Diff line change
@@ -1 +1 @@
BUILD_NUM="1422"
BUILD_NUM="1425"
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

Expand Down Expand Up @@ -117,7 +118,7 @@ private void init() {
@Override
public void connectIfDown() {
try {
if (!connectLock.tryLock())
if (!connectLock.tryLock(30, TimeUnit.SECONDS))
return;

if (!OpenAudioMc.getService(StateService.class).getCurrentState().canConnect()) {
Expand All @@ -128,6 +129,8 @@ public void connectIfDown() {
// update state
OpenAudioMc.getService(OpenaudioAccountService.class).startVoiceHandshake();
socketConnection.setupConnection();
} catch (InterruptedException e) {
// ignore - its okay
} finally {
connectLock.unlock();
}
Expand Down
2 changes: 1 addition & 1 deletion plugin/src/main/resources/data.bin
Original file line number Diff line number Diff line change
@@ -1 +1 @@
BUILD_NUM="1422"
BUILD_NUM="1425"
4 changes: 2 additions & 2 deletions plugin/src/main/resources/openaudiomc-build.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
BUILD_VERSION="1422"
BUILD_COMMIT="a240b0a022573dc70f34c337f24af00706700423"
BUILD_VERSION="1425"
BUILD_COMMIT="77a978d05757e72d10c56304722a8dbd50ea118e"
BUILD_AUTHOR="Mats"

0 comments on commit 84fee7f

Please sign in to comment.