You've already forked lidgren-network-gen3
mirror of
https://github.com/lidgren/lidgren-network-gen3.git
synced 2026-05-15 22:56:30 +09:00
Avoid array duplication of an array that is not accesible.
Avoid extra array allocations with reads that require a byte array. (corrected with the comment of @Inverness)
This commit is contained in:
@@ -24,7 +24,8 @@ namespace Lidgren.Network
|
||||
/// <param name="method">How to deliver the message</param>
|
||||
public void SendToAll(NetOutgoingMessage msg, NetDeliveryMethod method)
|
||||
{
|
||||
var all = this.Connections;
|
||||
// Modifying m_connections will modify the list of the connections of the NetPeer. Do only reads here
|
||||
var all = m_connections;
|
||||
if (all.Count <= 0) {
|
||||
if (msg.m_isSent == false)
|
||||
Recycle(msg);
|
||||
@@ -43,7 +44,8 @@ namespace Lidgren.Network
|
||||
/// <param name="sequenceChannel">Which sequence channel to use for the message</param>
|
||||
public void SendToAll(NetOutgoingMessage msg, NetConnection except, NetDeliveryMethod method, int sequenceChannel)
|
||||
{
|
||||
var all = this.Connections;
|
||||
// Modifying m_connections will modify the list of the connections of the NetPeer. Do only reads here
|
||||
var all = m_connections;
|
||||
if (all.Count <= 0) {
|
||||
if (msg.m_isSent == false)
|
||||
Recycle(msg);
|
||||
|
||||
Reference in New Issue
Block a user