diff --git a/core/src/io/anuke/mindustry/core/NetClient.java b/core/src/io/anuke/mindustry/core/NetClient.java index 6d880215f4..26523f4e59 100644 --- a/core/src/io/anuke/mindustry/core/NetClient.java +++ b/core/src/io/anuke/mindustry/core/NetClient.java @@ -199,8 +199,10 @@ public class NetClient extends Module{ @Remote(variants = Variant.one, priority = PacketPriority.low, unreliable = true) public static void onSnapshot(byte[] chunk, int snapshotID, short chunkID, int totalLength, int base){ + int totalChunks = Mathf.ceil((float) totalLength / NetServer.maxSnapshotSize); + if(NetServer.debugSnapshots) - Log.info("Recieved snapshot: len {0} ID {1} chunkID {2} totalLength {3} base {4} client-base {5}", chunk.length, snapshotID, chunkID, totalLength, base, netClient.lastSnapshotBaseID); + Log.info("Recieved snapshot: len {0} ID {1} chunkID {2} / "+totalChunks+" totalLength {3} base {4} client-base {5}", chunk.length, snapshotID, chunkID, totalLength, base, netClient.lastSnapshotBaseID); //skip snapshot IDs that have already been recieved OR snapshots that are too far in front if(base != -1 && (snapshotID < netClient.lastSnapshotBaseID || !netClient.recievedSnapshots.containsKey(base))){ @@ -214,7 +216,6 @@ public class NetClient extends Module{ //total length exceeds that needed to hold one snapshot, therefore, it is split into chunks if(totalLength > NetServer.maxSnapshotSize){ //total amount of chunks to recieve - int totalChunks = Mathf.ceil((float) totalLength / NetServer.maxSnapshotSize); //reset status when a new snapshot sending begins if(netClient.currentSnapshotID != snapshotID || netClient.recievedChunks == null || netClient.recievedChunks.length != totalChunks){ diff --git a/kryonet/src/io/anuke/kryonet/KryoServer.java b/kryonet/src/io/anuke/kryonet/KryoServer.java index 9a06cce0a5..259bc526f6 100644 --- a/kryonet/src/io/anuke/kryonet/KryoServer.java +++ b/kryonet/src/io/anuke/kryonet/KryoServer.java @@ -132,8 +132,10 @@ public class KryoServer implements ServerProvider { //this only opens the default port due to security concerns (?) if(port == Vars.port){ async(() -> { - if(!UPnP.isMappedTCP(port)) UPnP.openPortTCP(port); - if(!UPnP.isMappedUDP(port)) UPnP.openPortUDP(port); + try{ + if(!UPnP.isMappedTCP(port)) UPnP.openPortTCP(port); + if(!UPnP.isMappedUDP(port)) UPnP.openPortUDP(port); + }catch(Throwable ignored){} }); }