(f2e516dfe) v0.9.3.2

This commit is contained in:
Joonas Rikkonen
2019-09-20 20:11:18 +03:00
parent 80698b58b0
commit 9aa12bcac2
144 changed files with 1653 additions and 1559 deletions
@@ -37,8 +37,8 @@ namespace Barotrauma.Networking
Retries = 0;
SteamID = null;
PasswordSalt = null;
UpdateTime = Timing.TotalTime;
TimeOut = 20.0;
UpdateTime = Timing.TotalTime+Timing.Step*3.0;
TimeOut = NetworkConnection.TimeoutThreshold;
AuthSessionStarted = false;
}
}
@@ -319,7 +319,7 @@ namespace Barotrauma.Networking
{
if (netServer == null) { return; }
pendingClient.TimeOut = 20.0;
pendingClient.TimeOut = NetworkConnection.TimeoutThreshold;
ConnectionInitialization initializationStep = (ConnectionInitialization)inc.ReadByte();
@@ -327,6 +327,8 @@ namespace Barotrauma.Networking
if (pendingClient.InitializationStep != initializationStep) return;
pendingClient.UpdateTime = Timing.TotalTime + Timing.Step;
switch (initializationStep)
{
case ConnectionInitialization.SteamTicketAndVersion:
@@ -522,6 +524,7 @@ namespace Barotrauma.Networking
}
OnInitializationComplete?.Invoke(newConnection);
return;
}
@@ -554,6 +557,10 @@ namespace Barotrauma.Networking
}
NetSendResult result = netServer.SendMessage(outMsg, pendingClient.Connection, NetDeliveryMethod.ReliableUnordered);
if (result != NetSendResult.Sent && result != NetSendResult.Queued)
{
DebugConsole.NewMessage("Failed to send initialization step " + pendingClient.InitializationStep.ToString() + " to pending client: " + result.ToString(), Microsoft.Xna.Framework.Color.Yellow);
}
//DebugConsole.NewMessage("sent update to pending client: "+result);
}
@@ -588,7 +595,7 @@ namespace Barotrauma.Networking
if (netServer == null) { return; }
PendingClient pendingClient = pendingClients.Find(c => c.SteamID == steamID);
DebugConsole.NewMessage(steamID + " validation: " + status+", "+(pendingClient!=null));
DebugConsole.Log(steamID + " validation: " + status+", "+(pendingClient!=null));
if (pendingClient == null)
{
@@ -653,7 +660,11 @@ namespace Barotrauma.Networking
lidgrenMsg.Write((UInt16)length);
lidgrenMsg.Write(msgData, 0, length);
netServer.SendMessage(lidgrenMsg, lidgrenConn.NetConnection, lidgrenDeliveryMethod);
NetSendResult result = netServer.SendMessage(lidgrenMsg, lidgrenConn.NetConnection, lidgrenDeliveryMethod);
if (result != NetSendResult.Sent && result != NetSendResult.Queued)
{
DebugConsole.NewMessage("Failed to send message to "+conn.Name+": " + result.ToString(), Microsoft.Xna.Framework.Color.Yellow);
}
}
public override void Disconnect(NetworkConnection conn,string msg=null)
@@ -40,14 +40,14 @@ namespace Barotrauma.Networking
Retries = 0;
SteamID = steamId;
PasswordSalt = null;
UpdateTime = Timing.TotalTime;
TimeOut = 20.0;
UpdateTime = Timing.TotalTime+Timing.Step*3.0;
TimeOut = NetworkConnection.TimeoutThreshold;
AuthSessionStarted = false;
}
public void Heartbeat()
{
TimeOut = 5.0;
TimeOut = NetworkConnection.TimeoutThreshold;
}
}
@@ -228,7 +228,7 @@ namespace Barotrauma.Networking
if (isServerMessage)
{
DebugConsole.ThrowError("got server message from" + senderSteamId.ToString());
DebugConsole.ThrowError("Got server message from" + senderSteamId.ToString());
return;
}
@@ -346,7 +346,11 @@ namespace Barotrauma.Networking
NetOutgoingMessage outMsg = netServer.CreateMessage();
outMsg.Write(OwnerSteamID);
outMsg.Write((byte)(PacketHeader.IsConnectionInitializationStep | PacketHeader.IsServerMessage));
netServer.SendMessage(outMsg, netConnection, NetDeliveryMethod.ReliableUnordered);
NetSendResult result = netServer.SendMessage(outMsg, netConnection, NetDeliveryMethod.ReliableUnordered);
if (result != NetSendResult.Sent && result != NetSendResult.Queued)
{
DebugConsole.NewMessage("Failed to send connection confirmation message to owner: " + result.ToString(), Microsoft.Xna.Framework.Color.Yellow);
}
break;
case NetConnectionStatus.Disconnected:
DebugConsole.NewMessage("Owner disconnected: closing the server...");
@@ -360,7 +364,7 @@ namespace Barotrauma.Networking
{
if (netServer == null) { return; }
pendingClient.TimeOut = 20.0;
pendingClient.TimeOut = NetworkConnection.TimeoutThreshold;
ConnectionInitialization initializationStep = (ConnectionInitialization)inc.ReadByte();
@@ -368,6 +372,8 @@ namespace Barotrauma.Networking
if (pendingClient.InitializationStep != initializationStep) return;
pendingClient.UpdateTime = Timing.TotalTime+Timing.Step;
switch (initializationStep)
{
case ConnectionInitialization.SteamTicketAndVersion:
@@ -549,6 +555,10 @@ namespace Barotrauma.Networking
if (netConnection != null)
{
NetSendResult result = netServer.SendMessage(outMsg, netConnection, NetDeliveryMethod.ReliableUnordered);
if (result != NetSendResult.Sent && result != NetSendResult.Queued)
{
DebugConsole.NewMessage("Failed to send initialization step " + pendingClient.InitializationStep.ToString() + " to pending client: " + result.ToString(), Microsoft.Xna.Framework.Color.Yellow);
}
}
}
@@ -609,7 +619,11 @@ namespace Barotrauma.Networking
lidgrenMsg.Write((UInt16)length);
lidgrenMsg.Write(msgData, 0, length);
netServer.SendMessage(lidgrenMsg, netConnection, lidgrenDeliveryMethod);
NetSendResult result = netServer.SendMessage(lidgrenMsg, netConnection, lidgrenDeliveryMethod);
if (result != NetSendResult.Sent && result != NetSendResult.Queued)
{
DebugConsole.NewMessage("Failed to send message to " + conn.Name + ": " + result.ToString(), Microsoft.Xna.Framework.Color.Yellow);
}
}
private void SendDisconnectMessage(UInt64 steamId, string msg)
@@ -622,7 +636,11 @@ namespace Barotrauma.Networking
lidgrenMsg.Write((byte)(PacketHeader.IsDisconnectMessage | PacketHeader.IsServerMessage));
lidgrenMsg.Write(msg);
netServer.SendMessage(lidgrenMsg, netConnection, NetDeliveryMethod.ReliableUnordered);
NetSendResult result = netServer.SendMessage(lidgrenMsg, netConnection, NetDeliveryMethod.ReliableUnordered);
if (result != NetSendResult.Sent && result != NetSendResult.Queued)
{
DebugConsole.NewMessage("Failed to send disconnect message to " + Steam.SteamManager.SteamIDUInt64ToString(steamId) + ": " + result.ToString(), Microsoft.Xna.Framework.Color.Yellow);
}
}
private void Disconnect(NetworkConnection conn, string msg, bool sendDisconnectMessage)