v0.19.8.0
This commit is contained in:
@@ -1613,6 +1613,7 @@ namespace Barotrauma.Networking
|
||||
outmsg.WriteString(sub.Name);
|
||||
outmsg.WriteString(sub.MD5Hash.ToString());
|
||||
outmsg.WriteByte((byte)sub.SubmarineClass);
|
||||
outmsg.WriteBoolean(sub.HasTag(SubmarineTag.Shuttle));
|
||||
outmsg.WriteBoolean(sub.RequiredContentPackagesInstalled);
|
||||
}
|
||||
|
||||
@@ -1836,10 +1837,6 @@ namespace Barotrauma.Networking
|
||||
InGame = client.InGame,
|
||||
HasPermissions = client.Permissions != ClientPermissions.None,
|
||||
IsOwner = client.Connection == OwnerConnection,
|
||||
AllowKicking = client.Connection != OwnerConnection &&
|
||||
!client.HasPermission(ClientPermissions.Ban) &&
|
||||
!client.HasPermission(ClientPermissions.Kick) &&
|
||||
!client.HasPermission(ClientPermissions.Unban),
|
||||
IsDownloading = FileSender.ActiveTransfers.Any(t => t.Connection == client.Connection)
|
||||
};
|
||||
|
||||
@@ -3383,7 +3380,7 @@ namespace Barotrauma.Networking
|
||||
private IEnumerable<CoroutineStatus> SendClientPermissionsAfterClientListSynced(Client recipient, Client client)
|
||||
{
|
||||
DateTime timeOut = DateTime.Now + new TimeSpan(0, 0, 10);
|
||||
while (recipient.LastRecvClientListUpdate < LastClientListUpdateID)
|
||||
while (NetIdUtils.IdMoreRecent(LastClientListUpdateID, recipient.LastRecvClientListUpdate))
|
||||
{
|
||||
if (DateTime.Now > timeOut || GameMain.Server == null || !connectedClients.Contains(recipient))
|
||||
{
|
||||
|
||||
+3
-3
@@ -225,7 +225,7 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
else if (!packetHeader.IsConnectionInitializationStep())
|
||||
{
|
||||
if (!(connectedClients.Find(c => c is LidgrenConnection l && l.NetConnection == lidgrenMsg.SenderConnection) is LidgrenConnection conn))
|
||||
if (connectedClients.Find(c => c is LidgrenConnection l && l.NetConnection == lidgrenMsg.SenderConnection) is not LidgrenConnection conn)
|
||||
{
|
||||
if (pendingClient != null)
|
||||
{
|
||||
@@ -373,7 +373,7 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
if (netServer == null) { return; }
|
||||
|
||||
if (!(conn is LidgrenConnection lidgrenConn)) { return; }
|
||||
if (conn is not LidgrenConnection lidgrenConn) { return; }
|
||||
|
||||
if (connectedClients.Contains(lidgrenConn))
|
||||
{
|
||||
@@ -432,7 +432,7 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!packet.SteamId.TryUnwrap(out var id) || !(id is SteamId steamId))
|
||||
if (!packet.SteamId.TryUnwrap(out var id) || id is not SteamId steamId)
|
||||
{
|
||||
if (requireSteamAuth)
|
||||
{
|
||||
|
||||
+8
-1
@@ -167,7 +167,14 @@ namespace Barotrauma.Networking
|
||||
if (pendingClient.AccountInfo.AccountId.TryUnwrap(out var id)) { banAccountId(id); }
|
||||
|
||||
pendingClient.AccountInfo.OtherMatchingIds.ForEach(banAccountId);
|
||||
serverSettings.BanList.BanPlayer(pendingClient.Name ?? "Player", pendingClient.Connection.Endpoint, banReason, duration);
|
||||
if (pendingClient.AccountInfo.AccountId.TryUnwrap(out var accountId))
|
||||
{
|
||||
serverSettings.BanList.BanPlayer(pendingClient.Name ?? "Player", accountId, banReason, duration);
|
||||
}
|
||||
else
|
||||
{
|
||||
serverSettings.BanList.BanPlayer(pendingClient.Name ?? "Player", pendingClient.Connection.Endpoint, banReason, duration);
|
||||
}
|
||||
}
|
||||
|
||||
protected bool IsPendingClientBanned(PendingClient pendingClient, out string? banReason)
|
||||
|
||||
+25
-25
@@ -1,8 +1,6 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace Barotrauma.Networking
|
||||
{
|
||||
@@ -139,7 +137,27 @@ namespace Barotrauma.Networking
|
||||
pendingClient?.Heartbeat();
|
||||
connectedClient?.Heartbeat();
|
||||
|
||||
if (serverSettings.BanList.IsBanned(senderSteamId, out string banReason) ||
|
||||
if (packetHeader.IsConnectionInitializationStep())
|
||||
{
|
||||
if (!initialization.HasValue) { return; }
|
||||
ConnectionInitialization initializationStep = initialization.Value;
|
||||
|
||||
if (pendingClient != null)
|
||||
{
|
||||
pendingClient.Connection.SetAccountInfo(new AccountInfo(senderSteamId, sentOwnerSteamId));
|
||||
ReadConnectionInitializationStep(
|
||||
pendingClient,
|
||||
new ReadWriteMessage(inc.Buffer, inc.BitPosition, inc.LengthBits, false),
|
||||
initializationStep);
|
||||
}
|
||||
else if (initializationStep == ConnectionInitialization.ConnectionStarted)
|
||||
{
|
||||
pendingClient = new PendingClient(new SteamP2PConnection(senderSteamId));
|
||||
pendingClient.Connection.SetAccountInfo(new AccountInfo(senderSteamId, sentOwnerSteamId));
|
||||
pendingClients.Add(pendingClient);
|
||||
}
|
||||
}
|
||||
else if (serverSettings.BanList.IsBanned(senderSteamId, out string banReason) ||
|
||||
serverSettings.BanList.IsBanned(sentOwnerSteamId, out banReason))
|
||||
{
|
||||
if (pendingClient != null)
|
||||
@@ -167,24 +185,6 @@ namespace Barotrauma.Networking
|
||||
//message exists solely as a heartbeat, ignore its contents
|
||||
return;
|
||||
}
|
||||
else if (packetHeader.IsConnectionInitializationStep())
|
||||
{
|
||||
if (!initialization.HasValue) { return; }
|
||||
ConnectionInitialization initializationStep = initialization.Value;
|
||||
|
||||
if (pendingClient != null)
|
||||
{
|
||||
pendingClient.Connection.SetAccountInfo(new AccountInfo(senderSteamId, sentOwnerSteamId));
|
||||
ReadConnectionInitializationStep(
|
||||
pendingClient,
|
||||
new ReadWriteMessage(inc.Buffer, inc.BitPosition, inc.LengthBits, false),
|
||||
initializationStep);
|
||||
}
|
||||
else if (initializationStep == ConnectionInitialization.ConnectionStarted)
|
||||
{
|
||||
pendingClients.Add(new PendingClient(new SteamP2PConnection(senderSteamId)));
|
||||
}
|
||||
}
|
||||
else if (connectedClient != null)
|
||||
{
|
||||
var packet = INetSerializableStruct.Read<PeerPacketMessage>(inc);
|
||||
@@ -248,7 +248,7 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
if (!started) { return; }
|
||||
|
||||
if (!(conn is SteamP2PConnection steamP2PConn)) { return; }
|
||||
if (conn is not SteamP2PConnection steamP2PConn) { return; }
|
||||
|
||||
if (!connectedClients.Contains(steamP2PConn) && conn != OwnerConnection)
|
||||
{
|
||||
@@ -256,7 +256,7 @@ namespace Barotrauma.Networking
|
||||
return;
|
||||
}
|
||||
|
||||
if (!conn.AccountInfo.AccountId.TryUnwrap(out var connAccountId) || !(connAccountId is SteamId connSteamId)) { return; }
|
||||
if (!conn.AccountInfo.AccountId.TryUnwrap(out var connAccountId) || connAccountId is not SteamId) { return; }
|
||||
|
||||
byte[] bufAux = msg.PrepareForSending(compressPastThreshold, out bool isCompressed, out _);
|
||||
|
||||
@@ -292,9 +292,9 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
if (!started) { return; }
|
||||
|
||||
if (!(conn is SteamP2PConnection steamp2pConn)) { return; }
|
||||
if (conn is not SteamP2PConnection steamp2pConn) { return; }
|
||||
|
||||
if (!conn.AccountInfo.AccountId.TryUnwrap(out var connAccountId) || !(connAccountId is SteamId connSteamId)) { return; }
|
||||
if (!conn.AccountInfo.AccountId.TryUnwrap(out var connAccountId) || connAccountId is not SteamId connSteamId) { return; }
|
||||
|
||||
SendDisconnectMessage(connSteamId, peerDisconnectPacket);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user