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
recycle outgoing messages even when throwing exception because of invalid recipients
This commit is contained in:
@@ -157,6 +157,7 @@ namespace Lidgren.Network
|
||||
if (serverConnection == null)
|
||||
{
|
||||
LogWarning("Cannot send message, no server connection!");
|
||||
Recycle(msg);
|
||||
return NetSendResult.FailedNotConnected;
|
||||
}
|
||||
|
||||
|
||||
@@ -104,9 +104,17 @@ namespace Lidgren.Network
|
||||
if (msg == null)
|
||||
throw new ArgumentNullException("msg");
|
||||
if (recipients == null)
|
||||
{
|
||||
if (msg.m_isSent == false)
|
||||
Recycle(msg);
|
||||
throw new ArgumentNullException("recipients");
|
||||
}
|
||||
if (recipients.Count < 1)
|
||||
{
|
||||
if (msg.m_isSent == false)
|
||||
Recycle(msg);
|
||||
throw new NetException("recipients must contain at least one item");
|
||||
}
|
||||
if (method == NetDeliveryMethod.Unreliable || method == NetDeliveryMethod.ReliableUnordered)
|
||||
NetException.Assert(sequenceChannel == 0, "Delivery method " + method + " cannot use sequence channels other than 0!");
|
||||
if (msg.m_isSent)
|
||||
|
||||
Reference in New Issue
Block a user