breaking: Remove NetworkClient.serverIP (#3394)

* breaking: Remove NetworkClient.serverIP
- If we're never going to set it to anything, no reason to have it.
- Transport has no mechanism to return anything for it

Host client hardcodes `address` to "localhost" in both LocalConnectionToServer and LocalConnetionToClient, so obsolete the former telling users to use the latter if they aren't already.

Users can get the endpoint from NetworkManager or Discovery, as they must be doing now since those work and serverIp does not.

* Update main.yml

* fix: kcp2p V1.30 (#3391)

- fix: set send/recv buffer sizes directly instead of iterating to find the limit.
  fixes: https://github.com/MirrorNetworking/Mirror/issues/3390
- fix: server & client sockets are now always non-blocking to ensure main thread never
  blocks on socket.recv/send. Send() now also handles WouldBlock.
- fix: socket.Receive/From directly with non-blocking sockets and handle WouldBlock,
  instead of socket.Poll. faster, more obvious, and fixes Poll() looping forever while
  socket is in error state. fixes: https://github.com/MirrorNetworking/Mirror/issues/2733

* Shortened PingWindowSize to get a faster more accurate result. (#3395)

* Shortened PingWindowSize to get a faster more accurate result.

Shortened PingWindowSize to get a faster more accurate result.
It taking too long to calculate the average may look bad to users

* Revert "Shortened PingWindowSize to get a faster more accurate result."

This reverts commit 0a5916b4dc.

* Revert "Shortened PingWindowSize to get a faster more accurate result."

This reverts commit 0a5916b4dc.

* Shortened PingWindowSize to get a faster more accurate result.

Shortened PingWindowSize to get a faster more accurate result.
It taking too long to calculate the average may look bad to users

* Shortened PingWindowSize to get a faster more accurate result.

Shortened PingWindowSize to get a faster more accurate result.
It taking too long to calculate the average may look bad to users, choosing 6 gives us an average of 3 results, where as the previous 10, would wait for 5, it should be a slight visual improvement.

* fix: Use PingWindowSize instead of hardcoded value (#3396)

fix: Use PingWindowSize instead of hardcoded value

* KcpClient: Tick/Incoming/Outgoing can now be overwritten (virtual)

* RunUnityTests - Updated unityVersion

* fix: Write for non-spawned NB only writes 0 netId (fixes: #3399) (#3400)

* Failing test for non-spawned NB writer/reader

* fix: Write for non-spawned NB only writes 0 netId

Instead of writing 0 and component index which does not match what the reader expects (it will stop reading netId is 0)
Fixes #3399

* breaking: Removed old Unity 2018 / 2019_3 compiler defines (#3397)

- we only suppport Unity 2019.4.40 and later LTS releases.
BREAKING: Removed old 2018 / 2019 compiler defines

* RunUnityTests - try different test reporter

* RunUnityTests commented out Archive and Publish temporarily

* RunUnityTests - disable game-ci built-in test reporter

* RunUnityTests - cleanup

---------

Co-authored-by: mischa <16416509+vis2k@users.noreply.github.com>
Co-authored-by: JesusLuvsYooh <57072365+JesusLuvsYooh@users.noreply.github.com>
Co-authored-by: vis2k <info@noobtuts.com>
Co-authored-by: Robin Rolf <imer@imer.cc>
This commit is contained in:
MrGadget 2023-03-04 00:39:30 -05:00 committed by GitHub
parent 811dfd09cc
commit 91014bd614
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 5 additions and 23 deletions

View File

@ -13,7 +13,9 @@ public class LocalConnectionToServer : NetworkConnectionToServer
// packet queue
internal readonly Queue<NetworkWriterPooled> queue = new Queue<NetworkWriterPooled>();
public override string address => "localhost";
// Deprecated 2023-02-23
[Obsolete("Use LocalConnectionToClient.address instead.")]
public string address => "localhost";
// see caller for comments on why we need this
bool connectedEventPending;

View File

@ -59,10 +59,6 @@ public static partial class NetworkClient
// NetworkClient state
internal static ConnectState connectState = ConnectState.None;
/// <summary>IP address of the connection to server.</summary>
// empty if the client has not connected yet.
public static string serverIp => connection.address;
/// <summary>active is true while a client is connecting/connected either as standalone or as host client.</summary>
// (= while the network is active)
public static bool active => connectState == ConnectState.Connecting ||

View File

@ -27,9 +27,6 @@ public abstract class NetworkConnection
// state.
public bool isReady;
/// <summary>IP address of the connection. Can be useful for game master IP bans etc.</summary>
public abstract string address { get; }
/// <summary>Last time a message was received for this connection. Includes system and user messages.</summary>
public float lastMessageTime;

View File

@ -14,8 +14,7 @@ public class NetworkConnectionToClient : NetworkConnection
readonly NetworkWriter reliableRpcs = new NetworkWriter();
readonly NetworkWriter unreliableRpcs = new NetworkWriter();
public override string address =>
Transport.active.ServerGetClientAddress(connectionId);
public virtual string address => Transport.active.ServerGetClientAddress(connectionId);
/// <summary>NetworkIdentities that this connection can see</summary>
// TODO move to server's NetworkConnectionToClient?

View File

@ -5,8 +5,6 @@ namespace Mirror
{
public class NetworkConnectionToServer : NetworkConnection
{
public override string address => "";
// Send stage three: hand off to transport
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected override void SendToTransport(ArraySegment<byte> segment, int channelId = Channels.Reliable) =>

View File

@ -51,8 +51,6 @@ void Handler(NetworkConnection conn, TestMessage message)
[Test]
public void ServerToClient()
{
Assert.That(connectionToServer.address, Is.EqualTo("localhost"));
bool invoked = false;
void Handler(TestMessage message)
{

View File

@ -1,4 +1,4 @@
using System;
using System;
using NUnit.Framework;
namespace Mirror.Tests
@ -13,13 +13,6 @@ public override void SetUp()
NetworkServer.Listen(10);
}
[Test]
public void ServerIp()
{
NetworkClient.ConnectHost();
Assert.That(NetworkClient.serverIp, Is.EqualTo("localhost"));
}
[Test]
public void IsConnected()
{

View File

@ -144,7 +144,6 @@ public void ErrorForTargetRpcWhenNotGivenConnectionToClient()
}
class FakeConnection : NetworkConnection
{
public override string address => throw new NotImplementedException();
public override void Disconnect() => throw new NotImplementedException();
internal override void Send(ArraySegment<byte> segment, int channelId = 0) => throw new NotImplementedException();
protected override void SendToTransport(ArraySegment<byte> segment, int channelId = Channels.Reliable) => throw new NotImplementedException();