diff --git a/Lidgren.Network/NetPeer.Discovery.cs b/Lidgren.Network/NetPeer.Discovery.cs index 4533778..c03225c 100644 --- a/Lidgren.Network/NetPeer.Discovery.cs +++ b/Lidgren.Network/NetPeer.Discovery.cs @@ -50,6 +50,9 @@ namespace Lidgren.Network else if (msg.m_isSent) throw new NetException("Message has already been sent!"); + if (msg.LengthBytes >= m_configuration.MaximumTransmissionUnit) + throw new NetException("Cannot send discovery message larger than MTU (currently " + m_configuration.MaximumTransmissionUnit + " bytes)"); + msg.m_messageType = NetMessageType.DiscoveryResponse; m_unsentUnconnectedMessages.Enqueue(new NetTuple(recipient, msg)); }