Skip to content

Commit

Permalink
some improvements for the forge plattform
Browse files Browse the repository at this point in the history
  • Loading branch information
Brokkonaut committed Sep 12, 2023
1 parent 187fb38 commit 04d8bb7
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/main/java/de/cubeside/connection/GlobalClient.java
Expand Up @@ -105,9 +105,18 @@ private class ClientThread extends Thread {
private Socket socket;
private DataInputStream dis;
private DataOutputStream localDos;
private Runnable closingConnectionRunnable;

@Override
public void run() {
closingConnectionRunnable = new Runnable() {
@Override
public void run() {
if (connection == ClientThread.this) {
clearServersAndPlayers();
}
}
};
threadRunning = true;
DataOutputStream localerDos = null;
while (running && threadRunning) {
Expand Down Expand Up @@ -294,6 +303,7 @@ public void run() {
dis.readFully(data);
final UUID finalTargetUuid = targetUuid;
final String finalTargetServer = targetServer;
// processDataAsync(source, channel, targetUuid, targetServer, data);
runInMainThread(new Runnable() {
@Override
public void run() {
Expand Down Expand Up @@ -344,14 +354,7 @@ public void run() {
}
dis = null;
localDos = null;
runInMainThread(new Runnable() {
@Override
public void run() {
if (connection == ClientThread.this) {
clearServersAndPlayers();
}
}
});
runInMainThread(closingConnectionRunnable);
} catch (NoSuchAlgorithmException e) {
throw new Error(e); // impossible
}
Expand Down Expand Up @@ -594,6 +597,7 @@ protected synchronized void sendData(String channel, UUID targetUuid, String tar

public void shutdown() {
running = false;
dos = null;
ClientThread localConnection = this.connection;
if (localConnection != null) {
localConnection.shutdown();
Expand Down

0 comments on commit 04d8bb7

Please sign in to comment.