Merge branch 'heads/upstream' into OBT/1.2.0(SpringUpdate)
This commit is contained in:
@@ -39,6 +39,12 @@ namespace Barotrauma.Networking
|
||||
|
||||
public static int MaxEventPacketsPerUpdate = 4;
|
||||
|
||||
/// <summary>
|
||||
/// When enabled, uses more lenient Lidgren handshake timeouts (longer connection timeout, more retry attempts).
|
||||
/// Useful for local testing when running multiple instances on the same machine under heavy load.
|
||||
/// </summary>
|
||||
public static bool UseLenientHandshake;
|
||||
|
||||
/// <summary>
|
||||
/// Interpolates the positional error of a physics body towards zero.
|
||||
/// </summary>
|
||||
|
||||
@@ -33,13 +33,7 @@ namespace Barotrauma.Networking
|
||||
/// regarding its relation to values other than the input.
|
||||
/// </summary>
|
||||
public static ushort GetIdOlderThan(ushort id)
|
||||
#if DEBUG
|
||||
// Debug implementation has some RNG to discourage bad assumptions about the return value
|
||||
=> unchecked((ushort)(id - 1 - Rand.Int(500, sync: Rand.RandSync.Unsynced)));
|
||||
#else
|
||||
// Release implementation favors performance
|
||||
=> unchecked((ushort)(id - 1));
|
||||
#endif
|
||||
|
||||
public static ushort Difference(ushort id1, ushort id2)
|
||||
{
|
||||
|
||||
@@ -46,7 +46,6 @@ namespace Barotrauma.Networking
|
||||
TOGGLE_RESERVE_BENCH,
|
||||
|
||||
REQUEST_BACKUP_INDICES, // client wants a list of available backups for a save file
|
||||
LUA_NET_MESSAGE
|
||||
}
|
||||
|
||||
enum ClientNetSegment
|
||||
@@ -105,8 +104,6 @@ namespace Barotrauma.Networking
|
||||
UNLOCKRECIPE, //unlocking a fabrication recipe
|
||||
|
||||
SEND_BACKUP_INDICES, // the server sends a list of available backups for a save file
|
||||
|
||||
LUA_NET_MESSAGE
|
||||
}
|
||||
enum ServerNetSegment
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ using System.Linq;
|
||||
namespace Barotrauma.Networking
|
||||
{
|
||||
[NetworkSerialize]
|
||||
readonly struct AccountInfo : INetSerializableStruct
|
||||
public readonly struct AccountInfo : INetSerializableStruct
|
||||
{
|
||||
public static readonly AccountInfo None = new AccountInfo(Option<AccountId>.None());
|
||||
|
||||
@@ -48,4 +48,4 @@ namespace Barotrauma.Networking
|
||||
|
||||
public static bool operator !=(AccountInfo a, AccountInfo b) => !(a == b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+8
-3
@@ -15,13 +15,18 @@ sealed class SteamAuthTicketForEosHostAuthenticator : Authenticator
|
||||
{
|
||||
string ticketData = ToolBoxCore.ByteArrayToHexString(ticket.Data);
|
||||
|
||||
var client = new RestClient(ServerUrl);
|
||||
|
||||
var request = new RestRequest(ServerFile, Method.GET);
|
||||
var client = RestFactory.CreateClient(ServerUrl);
|
||||
var request = RestFactory.CreateRequest(ServerFile);
|
||||
request.AddParameter("authticket", ticketData);
|
||||
request.AddParameter("request_version", RemoteRequestVersion);
|
||||
|
||||
var response = await client.ExecuteAsync(request, Method.GET);
|
||||
if (response.ErrorException != null)
|
||||
{
|
||||
DebugConsole.AddWarning($"Connection error: Failed to verify Steam auth ticket for EOS host " +
|
||||
$"({response.ErrorException.Message}).");
|
||||
return AccountInfo.None;
|
||||
}
|
||||
if (!response.IsSuccessful) { return AccountInfo.None; }
|
||||
|
||||
try
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Barotrauma.Networking
|
||||
{
|
||||
abstract class Endpoint
|
||||
public abstract class Endpoint
|
||||
{
|
||||
public abstract string StringRepresentation { get; }
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ using System.Text;
|
||||
|
||||
namespace Barotrauma.Networking
|
||||
{
|
||||
interface IReadMessage
|
||||
public interface IReadMessage
|
||||
{
|
||||
bool ReadBoolean();
|
||||
void ReadPadBits();
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Barotrauma.Networking
|
||||
{
|
||||
interface IWriteMessage
|
||||
public interface IWriteMessage
|
||||
{
|
||||
void WriteBoolean(bool val);
|
||||
void WritePadBits();
|
||||
|
||||
+2
-2
@@ -8,14 +8,14 @@ namespace Barotrauma.Networking
|
||||
Disconnected = 0x2
|
||||
}
|
||||
|
||||
abstract class NetworkConnection<T> : NetworkConnection where T : Endpoint
|
||||
public abstract class NetworkConnection<T> : NetworkConnection where T : Endpoint
|
||||
{
|
||||
protected NetworkConnection(T endpoint) : base(endpoint) { }
|
||||
|
||||
public new T Endpoint => (base.Endpoint as T)!;
|
||||
}
|
||||
|
||||
abstract class NetworkConnection
|
||||
public abstract class NetworkConnection
|
||||
{
|
||||
public static double TimeoutThresholdNotInGame => GameMain.NetworkMember?.ServerSettings?.TimeoutThresholdNotInGame ?? 60.0; //full minute for timeout because loading screens can take quite a while
|
||||
public static double TimeoutThresholdInGame => GameMain.NetworkMember?.ServerSettings?.TimeoutThresholdInGame ?? 10.0;
|
||||
|
||||
@@ -213,9 +213,6 @@ namespace Barotrauma.Networking
|
||||
|
||||
public void Update(float deltaTime)
|
||||
{
|
||||
var result = GameMain.LuaCs.Hook.Call<bool?>("respawnManager.update");
|
||||
if (result != null && result.Value) { return; }
|
||||
|
||||
foreach (var teamSpecificState in teamSpecificStates.Values)
|
||||
{
|
||||
if (RespawnShuttles.None())
|
||||
|
||||
@@ -458,7 +458,7 @@ namespace Barotrauma.Networking
|
||||
private set;
|
||||
}
|
||||
|
||||
[Serialize(300.0f, IsPropertySaveable.Yes)]
|
||||
[Serialize(30.0f, IsPropertySaveable.Yes)]
|
||||
public float RespawnInterval
|
||||
{
|
||||
get;
|
||||
|
||||
Reference in New Issue
Block a user