Update weaver log, remove unused test and make transport send methods abstract (#2910)

* Turn on duplicate writer/reader logs in weaver

* Make Transport Client/ServerSend abstract

* Remove unused test
This commit is contained in:
Justin Nolan 2021-09-07 11:20:48 +08:00 committed by GitHub
parent fe021f8fe7
commit 32f0fa47ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 30 deletions

View File

@ -35,10 +35,7 @@ internal void Register(TypeReference dataType, MethodReference methodReference)
{
if (readFuncs.ContainsKey(dataType))
{
// TODO enable this again later.
// Reader has some obsolete functions that were renamed.
// Don't want weaver warnings for all of them.
//Weaver.Warning($"Registering a Read method for {dataType.FullName} when one already exists", methodReference);
Log.Warning($"Registering a Read method for {dataType.FullName} when one already exists", methodReference);
}
// we need to import type when we Initialize Readers so import here in case it is used anywhere else

View File

@ -35,10 +35,7 @@ public void Register(TypeReference dataType, MethodReference methodReference)
{
if (writeFuncs.ContainsKey(dataType))
{
// TODO enable this again later.
// Writer has some obsolete functions that were renamed.
// Don't want weaver warnings for all of them.
//Weaver.Warning($"Registering a Write method for {dataType.FullName} when one already exists", methodReference);
Log.Warning($"Registering a Write method for {dataType.FullName} when one already exists", methodReference);
}
// we need to import type when we Initialize Writers so import here in case it is used anywhere else

View File

@ -64,8 +64,7 @@ public virtual void ClientConnect(Uri uri)
/// <summary>Sends a message to the server over the given channel.</summary>
// The ArraySegment is only valid until returning. Copy if needed.
// TODO make abstract
public virtual void ClientSend(ArraySegment<byte> segment, int channelId) {}
public abstract void ClientSend(ArraySegment<byte> segment, int channelId);
/// <summary>Disconnects the client from the server</summary>
public abstract void ClientDisconnect();
@ -94,8 +93,7 @@ public virtual void ClientSend(ArraySegment<byte> segment, int channelId) {}
public abstract void ServerStart();
/// <summary>Send a message to a client over the given channel.</summary>
// TODO make abstract
public virtual void ServerSend(int connectionId, ArraySegment<byte> segment, int channelId) {}
public abstract void ServerSend(int connectionId, ArraySegment<byte> segment, int channelId);
/// <summary>Disconnect a client from the server.</summary>
public abstract void ServerDisconnect(int connectionId);

View File

@ -1250,23 +1250,5 @@ public void UpdateDetectsDestroyedEntryInObserving()
LogAssert.Expect(LogType.Warning, new Regex("Found 'null' entry in observing list.*"));
NetworkServer.NetworkLateUpdate();
}
// NetworkServer.Update iterates all connections.
// a timed out connection may call Disconnect, trying to modify the
// collection during the loop.
// -> test to prevent https://github.com/vis2k/Mirror/pull/2718
[Test]
public void UpdateWithTimedOutConnection()
{
// configure to disconnect with '0' timeout (= immediately)
// start
NetworkServer.Listen(1);
// add a connection
NetworkServer.connections[42] = new FakeNetworkConnection{isReady=true};
// update
NetworkServer.NetworkLateUpdate();
}
}
}