Skip to content

Commit

Permalink
Remove IceAdapter.running
Browse files Browse the repository at this point in the history
It was never set to false, thus it never had an effect.
  • Loading branch information
Brutus5000 committed Dec 6, 2024
1 parent 1f672ed commit 92b4366
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public class IceAdapter implements Callable<Integer>, AutoCloseable {
@CommandLine.ArgGroup(exclusive = false)
private IceOptions iceOptions;

private volatile boolean running = true;
private final ExecutorService executor = ExecutorHolder.getExecutor();
private static final Lock lockGameSession = new ReentrantLock();

Expand Down Expand Up @@ -195,10 +194,6 @@ public static double getAcceptableLatency() {
return INSTANCE.iceOptions.getAcceptableLatency();
}

public static boolean isRunning() {
return INSTANCE.running;
}

public static Executor getExecutor() {
return INSTANCE.executor;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ private static void onGpgnetConnectionLost() {
* Listens for incoming connections from a game instance
*/
private static void acceptThread() {
while (!Thread.currentThread().isInterrupted() && IceAdapter.isRunning()) {
while (!Thread.currentThread().isInterrupted()) {
try {
Socket socket = serverSocket.accept();
LockUtil.executeWithLock(lockSocket, () -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,7 @@ void onIceDataReceived(byte[] data, int offset, int length) {
private void faListener() {
byte[] data = new byte
[65536]; // 64KiB = UDP MTU, in practice due to ethernet frames being <= 1500 B, this is often not used
while (!Thread.currentThread().isInterrupted()
&& IceAdapter.isRunning()
&& IceAdapter.getGameSession() == gameSession
&& !closing) {
while (!Thread.currentThread().isInterrupted() && IceAdapter.getGameSession() == gameSession && !closing) {
try {
DatagramPacket packet = new DatagramPacket(data, data.length);
faSocket.receive(packet);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,9 +500,7 @@ public void listener() {

byte[] data = new byte
[65536]; // 64KiB = UDP MTU, in practice due to ethernet frames being <= 1500 B, this is often not used
while (!Thread.currentThread().isInterrupted()
&& IceAdapter.isRunning()
&& IceAdapter.getGameSession() == peer.getGameSession()) {
while (!Thread.currentThread().isInterrupted() && IceAdapter.getGameSession() == peer.getGameSession()) {
try {
DatagramPacket packet = new DatagramPacket(data, data.length);
localComponent
Expand Down

0 comments on commit 92b4366

Please sign in to comment.