Esempio n. 1
0
 //For reliable channel
 internal void RecycleAndDeliver(NetPacket packet)
 {
     if (packet.UserData != null)
     {
         if (packet.IsFragmented)
         {
             ushort fragCount;
             _deliveredFramgnets.TryGetValue(packet.FragmentId, out fragCount);
             fragCount++;
             if (fragCount == packet.FragmentsTotal)
             {
                 NetManager.MessageDelivered(this, packet.UserData);
                 _deliveredFramgnets.Remove(packet.FragmentId);
             }
             else
             {
                 _deliveredFramgnets[packet.FragmentId] = fragCount;
             }
         }
         else
         {
             NetManager.MessageDelivered(this, packet.UserData);
         }
         packet.UserData = null;
     }
     _packetPool.Recycle(packet);
 }