(6eeea9b7c) v0.9.10.0.0

This commit is contained in:
Joonas Rikkonen
2020-06-04 16:41:07 +03:00
parent ce4ccd99ac
commit eeac247a8e
366 changed files with 7772 additions and 3692 deletions
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using Barotrauma.IO;
using System.IO.Pipes;
using System.Linq;
using System.Text;
@@ -12,8 +12,8 @@ namespace Barotrauma.Networking
{
static partial class ChildServerRelay
{
private static Stream writeStream;
private static Stream readStream;
private static System.IO.Stream writeStream;
private static System.IO.Stream readStream;
private static volatile bool shutDown;
public static bool HasShutDown
{
@@ -233,7 +233,12 @@ namespace Barotrauma.Networking
{
writeStream?.Write(msg, 0, msg.Length);
}
catch (IOException)
catch (ObjectDisposedException)
{
shutDown = true;
break;
}
catch (System.IO.IOException)
{
shutDown = true;
break;
@@ -263,7 +268,12 @@ namespace Barotrauma.Networking
lengthBytes[1] = (byte)0;
writeStream?.Write(lengthBytes, 0, 2);
}
catch (IOException)
catch (ObjectDisposedException)
{
shutDown = true;
break;
}
catch (System.IO.IOException)
{
shutDown = true;
break;
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using Barotrauma.IO;
using System.Linq;
using System.Xml.Linq;
@@ -1,9 +1,8 @@
using System;
using System.Collections.Generic;
using System.IO;
using Barotrauma.IO;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;
namespace Barotrauma
@@ -116,7 +115,7 @@ namespace Barotrauma
doc = XMLExtensions.TryLoadXml(ConfigFile);
break;
}
catch (IOException)
catch (System.IO.IOException)
{
if (i == maxLoadRetries) { break; }
DebugConsole.NewMessage("Opening karma settings file \"" + ConfigFile + "\" failed, retrying in 250 ms...");
@@ -171,7 +170,7 @@ namespace Barotrauma
doc.Root.Add(preset.Value);
}
XmlWriterSettings settings = new XmlWriterSettings
System.Xml.XmlWriterSettings settings = new System.Xml.XmlWriterSettings
{
Indent = true,
NewLineOnAttributes = true
@@ -184,11 +183,11 @@ namespace Barotrauma
{
using (var writer = XmlWriter.Create(ConfigFile, settings))
{
doc.Save(writer);
doc.SaveSafe(writer);
}
break;
}
catch (IOException)
catch (System.IO.IOException)
{
if (i == maxLoadRetries) { throw; }
@@ -1,7 +1,7 @@
using Lidgren.Network;
using System;
using System.Collections.Generic;
using System.IO;
using Barotrauma.IO;
using System.IO.Compression;
using System.Runtime.InteropServices;
using System.Text;
@@ -519,7 +519,7 @@ namespace Barotrauma.Networking
}
else
{
using (MemoryStream output = new MemoryStream())
using (System.IO.MemoryStream output = new System.IO.MemoryStream())
{
using (DeflateStream dstream = new DeflateStream(output, CompressionLevel.Fastest))
{
@@ -613,9 +613,9 @@ namespace Barotrauma.Networking
if (isCompressed)
{
byte[] decompressedData;
using (MemoryStream input = new MemoryStream(inBuf, startPos, inLength))
using (System.IO.MemoryStream input = new System.IO.MemoryStream(inBuf, startPos, inLength))
{
using (MemoryStream output = new MemoryStream())
using (System.IO.MemoryStream output = new System.IO.MemoryStream())
{
using (DeflateStream dstream = new DeflateStream(input, CompressionMode.Decompress))
{
@@ -1,7 +1,7 @@
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.IO;
using Barotrauma.IO;
using System.Linq;
namespace Barotrauma.Networking
@@ -3,7 +3,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.IO;
using Barotrauma.IO;
using System.Linq;
using System.Net;
using System.Security.Cryptography;
@@ -125,12 +125,15 @@ namespace Barotrauma.Networking
msg.Write((UInt16)LatestBufferID);
msg.Write(ForceLocal); msg.WritePadBits();
for (int i = 0; i < BUFFER_COUNT; i++)
lock (buffers)
{
int index = (newestBufferInd + i + 1) % BUFFER_COUNT;
for (int i = 0; i < BUFFER_COUNT; i++)
{
int index = (newestBufferInd + i + 1) % BUFFER_COUNT;
msg.Write((byte)bufferLengths[index]);
msg.Write(buffers[index], 0, bufferLengths[index]);
msg.Write((byte)bufferLengths[index]);
msg.Write(buffers[index], 0, bufferLengths[index]);
}
}
}
@@ -144,10 +147,13 @@ namespace Barotrauma.Networking
ForceLocal = msg.ReadBoolean(); msg.ReadPadBits();
firstRead = false;
for (int i = 0; i < BUFFER_COUNT; i++)
lock (buffers)
{
bufferLengths[i] = msg.ReadByte();
buffers[i] = msg.ReadBytes(bufferLengths[i]);
for (int i = 0; i < BUFFER_COUNT; i++)
{
bufferLengths[i] = msg.ReadByte();
buffers[i] = msg.ReadBytes(bufferLengths[i]);
}
}
newestBufferInd = BUFFER_COUNT - 1;
LatestBufferID = incLatestBufferID;
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using Barotrauma.IO;
using System.Linq;
namespace Barotrauma.Networking