Log current thread, number all connections

This commit is contained in:
Bixilon 2020-08-23 21:56:51 +02:00
parent 04ab1b5254
commit 0d6b38297b
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
4 changed files with 15 additions and 11 deletions

View File

@ -68,7 +68,6 @@ public class Minosoft {
checkClientToken();
Connection c = new Connection(config.getString("debug.host"));
accountList = config.getMojangAccounts();
if (accountList.size() == 0) {
/*
@ -84,7 +83,7 @@ public class Minosoft {
} else {
Log.mojang("Could not refresh session, you will not be able to join premium servers!");
}
c.setPlayer(new Player(account));
Connection c = new Connection(1, config.getString("debug.host"), new Player(account));
c.resolve(ConnectionReason.CONNECT); // resolve dns address and connect
}

View File

@ -34,6 +34,8 @@ public class Log {
builder.append("[");
builder.append(timeFormat.format(System.currentTimeMillis()));
builder.append("] [");
builder.append(Thread.currentThread().getName());
builder.append("] [");
builder.append(l.name());
builder.append("] ");
if (color != null && Config.colorLog) {
@ -67,7 +69,7 @@ public class Log {
}
}
});
logThread.setName("Log-Thread");
logThread.setName("Log");
logThread.start();
}

View File

@ -45,18 +45,21 @@ public class Connection {
final PacketSender sender;
final ArrayList<ClientboundPacket> handlingQueue;
final VelocityHandler velocityHandler = new VelocityHandler(this);
final int connectionId;
ServerAddress address;
PluginChannelHandler pluginChannelHandler;
Thread handleThread;
Version version = Versions.getLowestVersionSupported(); // default
final CustomMapping customMapping = new CustomMapping(version);
Player player;
final Player player;
ConnectionState state = ConnectionState.DISCONNECTED;
ConnectionReason reason;
ConnectionReason nextReason;
ConnectionPing connectionStatusPing;
public Connection(String hostname) {
public Connection(int connectionId, String hostname, Player player) {
this.connectionId = connectionId;
this.player = player;
try {
addresses = DNSUtil.getServerAddresses(hostname);
} catch (TextParseException e) {
@ -216,10 +219,6 @@ public class Connection {
return player;
}
public void setPlayer(Player player) {
this.player = player;
}
public void sendPacket(ServerboundPacket p) {
network.sendPacket(p);
}
@ -245,7 +244,7 @@ public class Connection {
}
}
});
handleThread.setName("Handle-Thread");
handleThread.setName(String.format("%d/Handling", connectionId));
handleThread.start();
}
@ -323,4 +322,8 @@ public class Connection {
public VelocityHandler getVelocityHandler() {
return velocityHandler;
}
public int getConnectionId() {
return connectionId;
}
}

View File

@ -208,7 +208,7 @@ public class Network {
e.printStackTrace();
}
});
socketThread.setName("Socket-Thread");
socketThread.setName(String.format("%d/Socket", connection.getConnectionId()));
socketThread.start();
}