Added timestamps to NexusAuth and NexusData for a better graph

Small concurrent modification derp fix ?
This commit is contained in:
ProfMobius committed 2014-10-24 01:36:05 +02:00
1 parent 17ff3421fd
commit a18afdb975
3 files changed
+22 -7

No files matched your search

@@ -13,17 +13,20 @@ public class NexusAuth implements ISerializable {
SerialString uuid;
SerialString passphrase;
boolean reconnect;
long timestamp;
public NexusAuth(String uuid, String passphrase, boolean reconnect){
this.uuid = new SerialString(uuid);
this.passphrase = new SerialString(passphrase);
this.reconnect = reconnect;
this.timestamp = System.currentTimeMillis();
}
public NexusAuth(SerialString uuid, SerialString passphrase, boolean reconnect){
this.uuid = uuid;
this.passphrase = passphrase;
this.reconnect = reconnect;
this.reconnect = reconnect;
this.timestamp = System.currentTimeMillis();
}
@@ -32,6 +35,7 @@ public class NexusAuth implements ISerializable {
this.uuid.writeToStream(stream);
this.passphrase.writeToStream(stream);
stream.writeBoolean(reconnect);
stream.writeLong(this.timestamp);
}
public static NexusAuth readFromStream(ByteArrayDataInput stream){
@@ -18,7 +18,7 @@ public class NexusData implements ISerializable {
public SerialInt amountTileEnts;
public SerialInt amountEntities;
public SerialInt amountPlayers;
long timestamp;
public NexusData(SerialLong Packet_Outbound, SerialLong Packet_Inbound, SerialInt Chunk_Forced, SerialInt Chunk_Loaded,
@@ -32,6 +32,7 @@ public class NexusData implements ISerializable {
this.amountTileEnts = Amount_TileEnts;
this.amountEntities = Amount_Entities;
this.amountPlayers = Amount_Players;
this.timestamp = System.currentTimeMillis();
}
@@ -45,6 +46,7 @@ public class NexusData implements ISerializable {
this.amountTileEnts.writeToStream(stream);
this.amountEntities.writeToStream(stream);
this.amountPlayers.writeToStream(stream);
stream.writeLong(this.timestamp);
}
public static NexusData readFromStream(ByteArrayDataInput stream){
@@ -9,6 +9,7 @@ import io.netty.channel.SimpleChannelInboundHandler;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.ConcurrentModificationException;
import java.util.EnumMap;
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
@@ -257,12 +258,20 @@ public class PacketManager
channels.get(SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL);
channels.get(SERVER).writeAndFlush(packet);
for (FakePlayer fakePlayer : RConHandler.fakePlayersRcon.keySet()){
RConHandler.sendToPlayerRCon(packet, fakePlayer);
}
try{
for (FakePlayer fakePlayer : RConHandler.fakePlayersRcon.keySet()){
RConHandler.sendToPlayerRCon(packet, fakePlayer);
}
} catch (ConcurrentModificationException e){
}
for (FakePlayer fakePlayer : RConHandler.fakePlayersNexus.keySet()){
RConHandler.sendToPlayerNexus(packet, fakePlayer);
try{
for (FakePlayer fakePlayer : RConHandler.fakePlayersNexus.keySet()){
RConHandler.sendToPlayerNexus(packet, fakePlayer);
}
} catch (ConcurrentModificationException e){
}
}