You've already forked lidgren-network-gen3
mirror of
https://github.com/lidgren/lidgren-network-gen3.git
synced 2026-05-17 23: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)
|
if (serverConnection == null)
|
||||||
{
|
{
|
||||||
LogWarning("Cannot send message, no server connection!");
|
LogWarning("Cannot send message, no server connection!");
|
||||||
|
Recycle(msg);
|
||||||
return NetSendResult.FailedNotConnected;
|
return NetSendResult.FailedNotConnected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -104,9 +104,17 @@ namespace Lidgren.Network
|
|||||||
if (msg == null)
|
if (msg == null)
|
||||||
throw new ArgumentNullException("msg");
|
throw new ArgumentNullException("msg");
|
||||||
if (recipients == null)
|
if (recipients == null)
|
||||||
|
{
|
||||||
|
if (msg.m_isSent == false)
|
||||||
|
Recycle(msg);
|
||||||
throw new ArgumentNullException("recipients");
|
throw new ArgumentNullException("recipients");
|
||||||
|
}
|
||||||
if (recipients.Count < 1)
|
if (recipients.Count < 1)
|
||||||
|
{
|
||||||
|
if (msg.m_isSent == false)
|
||||||
|
Recycle(msg);
|
||||||
throw new NetException("recipients must contain at least one item");
|
throw new NetException("recipients must contain at least one item");
|
||||||
|
}
|
||||||
if (method == NetDeliveryMethod.Unreliable || method == NetDeliveryMethod.ReliableUnordered)
|
if (method == NetDeliveryMethod.Unreliable || method == NetDeliveryMethod.ReliableUnordered)
|
||||||
NetException.Assert(sequenceChannel == 0, "Delivery method " + method + " cannot use sequence channels other than 0!");
|
NetException.Assert(sequenceChannel == 0, "Delivery method " + method + " cannot use sequence channels other than 0!");
|
||||||
if (msg.m_isSent)
|
if (msg.m_isSent)
|
||||||
|
|||||||
Reference in New Issue
Block a user