Unstable 1.1.14.0
This commit is contained in:
@@ -53,7 +53,7 @@ namespace Barotrauma.Networking
|
||||
protected ConnectionInitialization initializationStep;
|
||||
public bool ContentPackageOrderReceived { get; set; }
|
||||
protected int passwordSalt;
|
||||
protected Steamworks.AuthTicket? steamAuthTicket;
|
||||
protected Option<Steamworks.AuthTicket> steamAuthTicket;
|
||||
private GUIMessageBox? passwordMsgBox;
|
||||
|
||||
public bool WaitingForPassword
|
||||
@@ -82,7 +82,7 @@ namespace Barotrauma.Networking
|
||||
Initialization = ConnectionInitialization.SteamTicketAndVersion
|
||||
};
|
||||
|
||||
if (steamAuthTicket is { Canceled: true })
|
||||
if (steamAuthTicket.TryUnwrap(out var authTicket) && authTicket is { Canceled: true })
|
||||
{
|
||||
throw new InvalidOperationException("ReadConnectionInitializationStep failed: Steam auth ticket has been cancelled.");
|
||||
}
|
||||
@@ -92,11 +92,7 @@ namespace Barotrauma.Networking
|
||||
Name = GameMain.Client.Name,
|
||||
OwnerKey = ownerKey,
|
||||
SteamId = SteamManager.GetSteamId().Select(id => (AccountId)id),
|
||||
SteamAuthTicket = steamAuthTicket?.Data switch
|
||||
{
|
||||
null => Option<byte[]>.None(),
|
||||
var ticketData => Option<byte[]>.Some(ticketData)
|
||||
},
|
||||
SteamAuthTicket = steamAuthTicket.Bind(t => t.Data != null ? Option.Some(t.Data) : Option.None),
|
||||
GameVersion = GameMain.Version.ToString(),
|
||||
Language = GameSettings.CurrentConfig.Language.Value
|
||||
};
|
||||
|
||||
+10
-5
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Lidgren.Network;
|
||||
using Barotrauma.Steam;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace Barotrauma.Networking
|
||||
{
|
||||
@@ -28,8 +29,12 @@ namespace Barotrauma.Networking
|
||||
|
||||
netPeerConfiguration = new NetPeerConfiguration("barotrauma")
|
||||
{
|
||||
UseDualModeSockets = GameSettings.CurrentConfig.UseDualModeSockets
|
||||
DualStack = GameSettings.CurrentConfig.UseDualModeSockets
|
||||
};
|
||||
if (endpoint.NetEndpoint.Address.AddressFamily == AddressFamily.InterNetworkV6)
|
||||
{
|
||||
netPeerConfiguration.LocalAddress = System.Net.IPAddress.IPv6Any;
|
||||
}
|
||||
|
||||
netPeerConfiguration.DisableMessageType(
|
||||
NetIncomingMessageType.DebugMessage
|
||||
@@ -53,8 +58,8 @@ namespace Barotrauma.Networking
|
||||
|
||||
if (SteamManager.IsInitialized)
|
||||
{
|
||||
steamAuthTicket = SteamManager.GetAuthSessionTicket();
|
||||
if (steamAuthTicket == null)
|
||||
steamAuthTicket = SteamManager.GetAuthSessionTicketForMultiplayer(ServerEndpoint);
|
||||
if (steamAuthTicket.IsNone())
|
||||
{
|
||||
throw new Exception("GetAuthSessionTicket returned null");
|
||||
}
|
||||
@@ -207,8 +212,8 @@ namespace Barotrauma.Networking
|
||||
netClient.Shutdown(peerDisconnectPacket.ToLidgrenStringRepresentation());
|
||||
netClient = null;
|
||||
|
||||
steamAuthTicket?.Cancel();
|
||||
steamAuthTicket = null;
|
||||
if (steamAuthTicket.TryUnwrap(out var ticket)) { ticket.Cancel(); }
|
||||
steamAuthTicket = Option.None;
|
||||
|
||||
callbacks.OnDisconnect.Invoke(peerDisconnectPacket);
|
||||
}
|
||||
|
||||
+3
-3
@@ -40,7 +40,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
ContentPackageOrderReceived = false;
|
||||
|
||||
steamAuthTicket = SteamManager.GetAuthSessionTicket();
|
||||
steamAuthTicket = SteamManager.GetAuthSessionTicketForMultiplayer(ServerEndpoint);
|
||||
//TODO: wait for GetAuthSessionTicketResponse_t
|
||||
|
||||
if (steamAuthTicket == null)
|
||||
@@ -363,8 +363,8 @@ namespace Barotrauma.Networking
|
||||
Steamworks.SteamNetworking.ResetActions();
|
||||
Steamworks.SteamNetworking.CloseP2PSessionWithUser(hostSteamId.Value);
|
||||
|
||||
steamAuthTicket?.Cancel();
|
||||
steamAuthTicket = null;
|
||||
if (steamAuthTicket.TryUnwrap(out var ticket)) { ticket.Cancel(); }
|
||||
steamAuthTicket = Option.None;
|
||||
|
||||
callbacks.OnDisconnect.Invoke(peerDisconnectPacket);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user