perf: MultiplexTransport: avoid Linq allocations that would happen on every packet send because Send calls .ServerActive() each time

This commit is contained in:
vis2k 2019-10-30 20:18:02 +01:00
parent 40f50ac908
commit 7fe8888df5

View File

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
@ -138,7 +137,15 @@ void InitServer()
public override bool ServerActive()
{
return transports.All(t => t.ServerActive());
// avoid Linq.All allocations
foreach (Transport transport in transports)
{
if (!transport.ServerActive())
{
return false;
}
}
return true;
}
public override string ServerGetClientAddress(int connectionId)