mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
perf: MultiplexTransport: avoid Linq allocations that would happen on every packet send because Send calls .ServerActive() each time
This commit is contained in:
parent
40f50ac908
commit
7fe8888df5
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user