mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-08-18 06:35:17 +03:00
Cleanup
This commit is contained in:
@@ -42,7 +42,7 @@ allprojects{
|
||||
if(!project.hasProperty("versionModifier")) versionModifier = 'release'
|
||||
if(!project.hasProperty("versionType")) versionType = 'official'
|
||||
appName = 'Mindustry'
|
||||
steamworksVersion = '3f07eb58e574691a717fb43ab30f3fa772a4b789'
|
||||
steamworksVersion = 'da41c05b7a2a44c8625ca0ba7d6ca1a2e73f621a'
|
||||
rhinoVersion = 'e74ac129d2bff72c1deb536d7d99a0dbb7046d2e'
|
||||
|
||||
loadVersionProps = {
|
||||
|
||||
@@ -108,7 +108,7 @@ public class SNet implements SteamNetworkingSocketsCallback, SteamMatchmakingCal
|
||||
|
||||
if(!readAny){
|
||||
try{
|
||||
Thread.sleep(12);
|
||||
Thread.sleep(15);
|
||||
}catch(InterruptedException ignored){
|
||||
return; //thread stopped
|
||||
}
|
||||
@@ -116,7 +116,10 @@ public class SNet implements SteamNetworkingSocketsCallback, SteamMatchmakingCal
|
||||
}
|
||||
}
|
||||
|
||||
/** Drains all currently-pending messages on one connection. Returns true if anything was read. */
|
||||
/**
|
||||
* Drains all currently-pending messages on one connection.
|
||||
* @return true if anything was read.
|
||||
* */
|
||||
boolean pollConnection(Connection connection, SteamConnection con) throws Exception{
|
||||
boolean readAny = false;
|
||||
int length;
|
||||
@@ -375,8 +378,7 @@ public class SNet implements SteamNetworkingSocketsCallback, SteamMatchmakingCal
|
||||
|
||||
Log.info("Connecting to owner @: @", currentServer.getAccountID(), friends.getFriendPersonaName(currentServer));
|
||||
|
||||
//begin the handshake; success/handleClientReceived/setClientConnected fire once onConnectionStatusChanged reports Connected
|
||||
clientConnection = snet.connectP2P(currentServer, 0);
|
||||
clientConnection = snet.connectP2P(currentServer, 0);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -417,18 +419,18 @@ public class SNet implements SteamNetworkingSocketsCallback, SteamMatchmakingCal
|
||||
boolean banned = banList.length() > 0 && Structs.contains(banList.split(","), SVars.user.user.getSteamID().getAccountID() + "");
|
||||
|
||||
Host out = new Host(
|
||||
-1, //invalid ping
|
||||
smat.getLobbyData(lobby, "name"),
|
||||
"steam:" + lobby.handle(),
|
||||
smat.getLobbyData(lobby, "mapname"),
|
||||
Strings.parseInt(smat.getLobbyData(lobby, "wave"), -1),
|
||||
smat.getNumLobbyMembers(lobby),
|
||||
Strings.parseInt(smat.getLobbyData(lobby, "version"), -1),
|
||||
smat.getLobbyData(lobby, "versionType"),
|
||||
Gamemode.valueOf(mode),
|
||||
smat.getLobbyMemberLimit(lobby),
|
||||
banned ? "[banned]" : "",
|
||||
null
|
||||
-1, //invalid ping
|
||||
smat.getLobbyData(lobby, "name"),
|
||||
"steam:" + lobby.handle(),
|
||||
smat.getLobbyData(lobby, "mapname"),
|
||||
Strings.parseInt(smat.getLobbyData(lobby, "wave"), -1),
|
||||
smat.getNumLobbyMembers(lobby),
|
||||
Strings.parseInt(smat.getLobbyData(lobby, "version"), -1),
|
||||
smat.getLobbyData(lobby, "versionType"),
|
||||
Gamemode.valueOf(mode),
|
||||
smat.getLobbyMemberLimit(lobby),
|
||||
banned ? "[banned]" : "",
|
||||
null
|
||||
);
|
||||
hosts.add(out);
|
||||
}catch(Exception e){
|
||||
@@ -479,8 +481,9 @@ public class SNet implements SteamNetworkingSocketsCallback, SteamMatchmakingCal
|
||||
if(net.server()){
|
||||
if(state == ConnectionState.Connecting){
|
||||
//256kb -> 1mb/sec for large worlds
|
||||
snet.setConnectionConfigValue(connection, SteamNetworkingConfigValue.SendRateMax, 1 * 1024 * 1024);
|
||||
snet.setConnectionConfigValue(connection, SteamNetworkingConfigValue.SendRateMin, 1 * 1024 * 1024);
|
||||
int limit = 1 * 1024 * 1024;
|
||||
snet.setConnectionConfigValue(connection, SteamNetworkingConfigValue.SendRateMax, limit);
|
||||
snet.setConnectionConfigValue(connection, SteamNetworkingConfigValue.SendRateMin, limit);
|
||||
|
||||
//incoming connection request arriving through our listen socket; accept it
|
||||
SteamResult result = snet.acceptConnection(connection);
|
||||
@@ -527,8 +530,6 @@ public class SNet implements SteamNetworkingSocketsCallback, SteamMatchmakingCal
|
||||
|
||||
net.setClientConnected();
|
||||
net.handleClientReceived(con);
|
||||
|
||||
Core.app.post(() -> Core.app.post(() -> Core.app.post(() -> Log.info("Server: @\nClient: @\nActive: @", net.server(), net.client(), net.active()))));
|
||||
}else if(state == ConnectionState.ClosedByPeer || state == ConnectionState.ProblemDetectedLocally){
|
||||
Log.info("Disconnected! @: @", remote.getAccountID(), state);
|
||||
|
||||
@@ -542,7 +543,7 @@ public class SNet implements SteamNetworkingSocketsCallback, SteamMatchmakingCal
|
||||
}
|
||||
}
|
||||
}catch(Exception e){
|
||||
Log.err("Error processing connection status change.", e);
|
||||
Log.err("Error processing connection status change", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -595,8 +596,7 @@ public class SNet implements SteamNetworkingSocketsCallback, SteamMatchmakingCal
|
||||
outgoing.poll();
|
||||
queuedBytes -= msg.buffer.capacity();
|
||||
}else if(result == SteamResult.LimitExceeded){
|
||||
//Steam's send buffer is full; stop draining for this tick and retry the SAME
|
||||
//message (preserving order) next poll instead of silently losing it
|
||||
//Steam's send buffer is full; stop draining and retry the same message (preserving order) next poll instead of silently losing it
|
||||
break;
|
||||
}else if(result == SteamResult.Ignored){
|
||||
//only possible with NoDelay-flagged unreliable sends; fine to drop and move on
|
||||
|
||||
@@ -26,4 +26,4 @@ org.gradle.caching=true
|
||||
org.gradle.internal.http.socketTimeout=100000
|
||||
org.gradle.internal.http.connectionTimeout=100000
|
||||
android.enableR8.fullMode=false
|
||||
archash=6a97615f6f
|
||||
archash=f40f5d64ae
|
||||
|
||||
Reference in New Issue
Block a user