springtg / lidgren-network-gen3

Automatically exported from code.google.com/p/lidgren-network-gen3
0 stars 0 forks source link

NetServer.SendToAll(NetOutgoingMessage msg, NetDeliveryMethod method) throws an exception when no Connections #95

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a NetServer instance
2. Create a NetOutgoingMessage instance and fill it with random data
3. Send the message with NetServer.SendToAll(NetOutgoingMessage msg, 
NetDeliveryMethod method)

What is the expected output? What do you see instead?
With such method, I'd expect the method to perform nothing when no connections 
are on the server. Instead, it throws an exception.

What version of the product are you using? On what operating system?
Latest version on Win7 x64

Please provide any additional information below.
This is a small request and I'm actually unsure of any other usecases that 
would require a different behavior.
This is the code that I'd like to see implemented:

/// <summary>
/// Send a message to all connections
/// </summary>
/// <param name="msg">The message to send</param>
/// <param name="method">How to deliver the message</param>
public void SendToAll(NetOutgoingMessage msg, NetDeliveryMethod method)
{
        if(this.ConnectionsCount > 0)
            SendMessage(msg, this.Connections, method, 0);
}

Original issue reported on code.google.com by webmaste...@gtempaccount.com on 17 Nov 2011 at 11:16

GoogleCodeExporter commented 9 years ago
Good call; fixed in rev 277

Original comment by lidg...@gmail.com on 9 Dec 2011 at 9:16