mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
breaking: obsolete Uri support
This commit is contained in:
parent
089e5bbb59
commit
9bbbf51df5
@ -145,6 +145,7 @@ public static void Connect(string address)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Connect client to a NetworkServer by Uri.</summary>
|
/// <summary>Connect client to a NetworkServer by Uri.</summary>
|
||||||
|
[Obsolete("We are considering to remove Uri support, unless someone has a good reason to keep it.")]
|
||||||
public static void Connect(Uri uri)
|
public static void Connect(Uri uri)
|
||||||
{
|
{
|
||||||
// Debug.Log("Client Connect: " + uri);
|
// Debug.Log("Client Connect: " + uri);
|
||||||
|
@ -362,6 +362,7 @@ public void StartClient()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Starts the client, connects it to the server via Uri</summary>
|
/// <summary>Starts the client, connects it to the server via Uri</summary>
|
||||||
|
[Obsolete("We are considering to remove Uri support, unless someone has a good reason to keep it.")]
|
||||||
public void StartClient(Uri uri)
|
public void StartClient(Uri uri)
|
||||||
{
|
{
|
||||||
if (NetworkClient.active)
|
if (NetworkClient.active)
|
||||||
|
@ -394,6 +394,7 @@ public static T[] ReadArray<T>(this NetworkReader reader)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Obsolete("We are considering to remove Uri support, unless someone has a good reason to keep it.")]
|
||||||
public static Uri ReadUri(this NetworkReader reader)
|
public static Uri ReadUri(this NetworkReader reader)
|
||||||
{
|
{
|
||||||
return new Uri(reader.ReadString());
|
return new Uri(reader.ReadString());
|
||||||
|
@ -413,6 +413,7 @@ public static void WriteGameObject(this NetworkWriter writer, GameObject value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Obsolete("We are considering to remove Uri support, unless someone has a good reason to keep it.")]
|
||||||
public static void WriteUri(this NetworkWriter writer, Uri uri)
|
public static void WriteUri(this NetworkWriter writer, Uri uri)
|
||||||
{
|
{
|
||||||
writer.WriteString(uri.ToString());
|
writer.WriteString(uri.ToString());
|
||||||
|
@ -63,6 +63,7 @@ public override void ClientConnect(string address)
|
|||||||
available.ClientConnect(address);
|
available.ClientConnect(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Obsolete("We are considering to remove Uri support, unless someone has a good reason to keep it.")]
|
||||||
public override void ClientConnect(Uri uri)
|
public override void ClientConnect(Uri uri)
|
||||||
{
|
{
|
||||||
foreach (Transport transport in transports)
|
foreach (Transport transport in transports)
|
||||||
@ -100,6 +101,7 @@ public override void ClientSend(ArraySegment<byte> segment, int channelId)
|
|||||||
|
|
||||||
// right now this just returns the first available uri,
|
// right now this just returns the first available uri,
|
||||||
// should we return the list of all available uri?
|
// should we return the list of all available uri?
|
||||||
|
[Obsolete("We are considering to remove Uri support, unless someone has a good reason to keep it.")]
|
||||||
public override Uri ServerUri() => available.ServerUri();
|
public override Uri ServerUri() => available.ServerUri();
|
||||||
|
|
||||||
public override bool ServerActive()
|
public override bool ServerActive()
|
||||||
|
@ -139,6 +139,7 @@ void OnDisable()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// server
|
// server
|
||||||
|
[Obsolete("We are considering to remove Uri support, unless someone has a good reason to keep it.")]
|
||||||
public override Uri ServerUri()
|
public override Uri ServerUri()
|
||||||
{
|
{
|
||||||
UriBuilder builder = new UriBuilder();
|
UriBuilder builder = new UriBuilder();
|
||||||
|
@ -143,6 +143,7 @@ public override void ClientConnect(string address)
|
|||||||
wrap.ClientConnect(address);
|
wrap.ClientConnect(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Obsolete("We are considering to remove Uri support, unless someone has a good reason to keep it.")]
|
||||||
public override void ClientConnect(Uri uri)
|
public override void ClientConnect(Uri uri)
|
||||||
{
|
{
|
||||||
wrap.OnClientConnected = OnClientConnected;
|
wrap.OnClientConnected = OnClientConnected;
|
||||||
@ -167,6 +168,7 @@ public override void ClientSend(ArraySegment<byte> segment, int channelId)
|
|||||||
SimulateSend(0, segment, channelId, latency, reliableClientToServer, unreliableClientToServer);
|
SimulateSend(0, segment, channelId, latency, reliableClientToServer, unreliableClientToServer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Obsolete("We are considering to remove Uri support, unless someone has a good reason to keep it.")]
|
||||||
public override Uri ServerUri() => wrap.ServerUri();
|
public override Uri ServerUri() => wrap.ServerUri();
|
||||||
|
|
||||||
public override bool ServerActive() => wrap.ServerActive();
|
public override bool ServerActive() => wrap.ServerActive();
|
||||||
|
@ -48,6 +48,7 @@ public override void ServerStart()
|
|||||||
public override void ServerSend(int connectionId, ArraySegment<byte> segment, int channelId) => inner.ServerSend(connectionId, segment, channelId);
|
public override void ServerSend(int connectionId, ArraySegment<byte> segment, int channelId) => inner.ServerSend(connectionId, segment, channelId);
|
||||||
public override void ServerDisconnect(int connectionId) => inner.ServerDisconnect(connectionId);
|
public override void ServerDisconnect(int connectionId) => inner.ServerDisconnect(connectionId);
|
||||||
public override string ServerGetClientAddress(int connectionId) => inner.ServerGetClientAddress(connectionId);
|
public override string ServerGetClientAddress(int connectionId) => inner.ServerGetClientAddress(connectionId);
|
||||||
|
[Obsolete("We are considering to remove Uri support, unless someone has a good reason to keep it.")]
|
||||||
public override Uri ServerUri() => inner.ServerUri();
|
public override Uri ServerUri() => inner.ServerUri();
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
@ -101,6 +101,7 @@ public override void ClientConnect(string address)
|
|||||||
throw new ArgumentException("No transport suitable for this platform");
|
throw new ArgumentException("No transport suitable for this platform");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Obsolete("We are considering to remove Uri support, unless someone has a good reason to keep it.")]
|
||||||
public override void ClientConnect(Uri uri)
|
public override void ClientConnect(Uri uri)
|
||||||
{
|
{
|
||||||
foreach (Transport transport in transports)
|
foreach (Transport transport in transports)
|
||||||
@ -198,6 +199,7 @@ void AddServerCallbacks()
|
|||||||
|
|
||||||
// for now returns the first uri,
|
// for now returns the first uri,
|
||||||
// should we return all available uris?
|
// should we return all available uris?
|
||||||
|
[Obsolete("We are considering to remove Uri support, unless someone has a good reason to keep it.")]
|
||||||
public override Uri ServerUri()
|
public override Uri ServerUri()
|
||||||
{
|
{
|
||||||
return transports[0].ServerUri();
|
return transports[0].ServerUri();
|
||||||
|
@ -272,6 +272,7 @@ public override string ServerGetClientAddress(int connectionId)
|
|||||||
return server.GetClientAddress(connectionId);
|
return server.GetClientAddress(connectionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Obsolete("We are considering to remove Uri support, unless someone has a good reason to keep it.")]
|
||||||
public override Uri ServerUri()
|
public override Uri ServerUri()
|
||||||
{
|
{
|
||||||
UriBuilder builder = new UriBuilder
|
UriBuilder builder = new UriBuilder
|
||||||
|
@ -123,6 +123,7 @@ public override bool Available()
|
|||||||
// client
|
// client
|
||||||
public override bool ClientConnected() => client.Connected;
|
public override bool ClientConnected() => client.Connected;
|
||||||
public override void ClientConnect(string address) => client.Connect(address, port);
|
public override void ClientConnect(string address) => client.Connect(address, port);
|
||||||
|
[Obsolete("We are considering to remove Uri support, unless someone has a good reason to keep it.")]
|
||||||
public override void ClientConnect(Uri uri)
|
public override void ClientConnect(Uri uri)
|
||||||
{
|
{
|
||||||
if (uri.Scheme != Scheme)
|
if (uri.Scheme != Scheme)
|
||||||
@ -148,6 +149,7 @@ public override void ClientEarlyUpdate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// server
|
// server
|
||||||
|
[Obsolete("We are considering to remove Uri support, unless someone has a good reason to keep it.")]
|
||||||
public override Uri ServerUri()
|
public override Uri ServerUri()
|
||||||
{
|
{
|
||||||
UriBuilder builder = new UriBuilder();
|
UriBuilder builder = new UriBuilder();
|
||||||
|
@ -55,6 +55,7 @@ public abstract class Transport : MonoBehaviour
|
|||||||
public abstract void ClientConnect(string address);
|
public abstract void ClientConnect(string address);
|
||||||
|
|
||||||
/// <summary>Connects the client to the server at the Uri.</summary>
|
/// <summary>Connects the client to the server at the Uri.</summary>
|
||||||
|
[Obsolete("We are considering to remove Uri support, unless someone has a good reason to keep it.")]
|
||||||
public virtual void ClientConnect(Uri uri)
|
public virtual void ClientConnect(Uri uri)
|
||||||
{
|
{
|
||||||
// By default, to keep backwards compatibility, just connect to the host
|
// By default, to keep backwards compatibility, just connect to the host
|
||||||
|
@ -113,6 +113,7 @@ public override void ClientEarlyUpdate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override bool ServerActive() => serverActive;
|
public override bool ServerActive() => serverActive;
|
||||||
|
[Obsolete("We are considering to remove Uri support, unless someone has a good reason to keep it.")]
|
||||||
public override Uri ServerUri() => throw new NotImplementedException();
|
public override Uri ServerUri() => throw new NotImplementedException();
|
||||||
public override void ServerStart() { serverActive = true; }
|
public override void ServerStart() { serverActive = true; }
|
||||||
public override void ServerSend(int connectionId, ArraySegment<byte> segment, int channelId)
|
public override void ServerSend(int connectionId, ArraySegment<byte> segment, int channelId)
|
||||||
|
@ -176,6 +176,7 @@ public void TestServerGetClientAddress(int id, string result)
|
|||||||
[Test]
|
[Test]
|
||||||
[TestCase("tcp4://localhost:7777")]
|
[TestCase("tcp4://localhost:7777")]
|
||||||
[TestCase("tcp4://example.com:7777")]
|
[TestCase("tcp4://example.com:7777")]
|
||||||
|
#pragma warning disable 618
|
||||||
public void TestServerUri(string address)
|
public void TestServerUri(string address)
|
||||||
{
|
{
|
||||||
Uri uri = new Uri(address);
|
Uri uri = new Uri(address);
|
||||||
@ -185,6 +186,7 @@ public void TestServerUri(string address)
|
|||||||
|
|
||||||
inner.Received(1).ServerUri();
|
inner.Received(1).ServerUri();
|
||||||
}
|
}
|
||||||
|
#pragma warning restore 618
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestClientConnectedCallback()
|
public void TestClientConnectedCallback()
|
||||||
|
@ -64,6 +64,7 @@ public void TestConnect()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// A Test behaves as an ordinary method
|
// A Test behaves as an ordinary method
|
||||||
|
#pragma warning disable 618
|
||||||
[Test]
|
[Test]
|
||||||
public void TestConnectFirstUri()
|
public void TestConnectFirstUri()
|
||||||
{
|
{
|
||||||
@ -76,9 +77,10 @@ public void TestConnectFirstUri()
|
|||||||
transport1.Received().ClientConnect(uri);
|
transport1.Received().ClientConnect(uri);
|
||||||
transport2.DidNotReceive().ClientConnect(uri);
|
transport2.DidNotReceive().ClientConnect(uri);
|
||||||
}
|
}
|
||||||
|
#pragma warning restore 61
|
||||||
|
|
||||||
// A Test behaves as an ordinary method
|
// A Test behaves as an ordinary method
|
||||||
|
#pragma warning disable 618
|
||||||
[Test]
|
[Test]
|
||||||
public void TestConnectSecondUri()
|
public void TestConnectSecondUri()
|
||||||
{
|
{
|
||||||
@ -96,6 +98,7 @@ public void TestConnectSecondUri()
|
|||||||
transport.ClientConnect(uri);
|
transport.ClientConnect(uri);
|
||||||
transport2.Received().ClientConnect(uri);
|
transport2.Received().ClientConnect(uri);
|
||||||
}
|
}
|
||||||
|
#pragma warning restore 618
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestConnected()
|
public void TestConnected()
|
||||||
|
@ -36,6 +36,7 @@ public void IsConnected()
|
|||||||
Assert.That(NetworkClient.isConnected, Is.True);
|
Assert.That(NetworkClient.isConnected, Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma warning disable 618
|
||||||
[Test]
|
[Test]
|
||||||
public void ConnectUri()
|
public void ConnectUri()
|
||||||
{
|
{
|
||||||
@ -44,6 +45,7 @@ public void ConnectUri()
|
|||||||
UpdateTransport();
|
UpdateTransport();
|
||||||
Assert.That(NetworkClient.isConnected, Is.True);
|
Assert.That(NetworkClient.isConnected, Is.True);
|
||||||
}
|
}
|
||||||
|
#pragma warning restore 618
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void DisconnectInHostMode()
|
public void DisconnectInHostMode()
|
||||||
|
@ -133,6 +133,7 @@ public void GetStartPositionTest()
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
#pragma warning disable 618
|
||||||
public void StartClientUriTest()
|
public void StartClientUriTest()
|
||||||
{
|
{
|
||||||
UriBuilder uriBuilder = new UriBuilder
|
UriBuilder uriBuilder = new UriBuilder
|
||||||
@ -146,5 +147,6 @@ public void StartClientUriTest()
|
|||||||
Assert.That(manager.isNetworkActive, Is.EqualTo(true));
|
Assert.That(manager.isNetworkActive, Is.EqualTo(true));
|
||||||
Assert.That(manager.networkAddress, Is.EqualTo(uriBuilder.Uri.Host));
|
Assert.That(manager.networkAddress, Is.EqualTo(uriBuilder.Uri.Host));
|
||||||
}
|
}
|
||||||
|
#pragma warning restore 618
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -904,6 +904,7 @@ public void TestWritingAndReading()
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
#pragma warning disable 618
|
||||||
public void TestWritingUri()
|
public void TestWritingUri()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -915,6 +916,7 @@ public void TestWritingUri()
|
|||||||
NetworkReader reader = new NetworkReader(writer.ToArray());
|
NetworkReader reader = new NetworkReader(writer.ToArray());
|
||||||
Assert.That(reader.ReadUri(), Is.EqualTo(testUri));
|
Assert.That(reader.ReadUri(), Is.EqualTo(testUri));
|
||||||
}
|
}
|
||||||
|
#pragma warning restore 618
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestList()
|
public void TestList()
|
||||||
|
Loading…
Reference in New Issue
Block a user