Avatarchik / lidgren-network-gen3

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

NetDeliveryMethod should be explicitly checked #9

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
After porting the Borg Server framework to use Gen3 instead he old lib some 
messages where randomly not sent. It turned out we forgot to set explicitly the 
NetDeliveryMethod on some places. Therefore our network pump sometimes used 0 
or other garbage values.

Rather than silently swallowing error condition (in release build without 
verbose on) and not sending the message an explicit check for valid 
NetDeliveryMethod values should be made resulting with an Exception on garbage.

Original issue reported on code.google.com by enriko.r...@gmail.com on 30 Jun 2010 at 9:41

GoogleCodeExporter commented 8 years ago
After digging some more the only problem is actually when the resulting 
NetMessageType becomes NetMessageType.Error due to : NetMessageType tp = 
(NetMessageType)((int)method + sequenceChannel);

Its unfortunate that the default (value 0) for NetDeliveryMethod is Unknown and 
therefore always causes the described problem :-( 

Anyway throwing an exception in SendMessage on NetDeliveryMethod.Unknown would 
be more helpful than enqueuing the message with NetMessageType.Error

Original comment by enriko.r...@gmail.com on 30 Jun 2010 at 8:15

GoogleCodeExporter commented 8 years ago
Good call; exception added in revision 63

Original comment by lidg...@gmail.com on 30 Jun 2010 at 9:11