/// <summary> /// Sends out pending acknowledgements /// </summary> /// <returns>Number of ACKs sent</returns> private int SendAcks() { uint ack; int ackCount = 0; if (PendingAcks.TryDequeue(out ack)) { List <PacketAckPacket.PacketsBlock> blocks = new List <PacketAckPacket.PacketsBlock>(); PacketAckPacket.PacketsBlock block = new PacketAckPacket.PacketsBlock(); block.ID = ack; blocks.Add(block); while (PendingAcks.TryDequeue(out ack)) { block = new PacketAckPacket.PacketsBlock(); block.ID = ack; blocks.Add(block); } PacketAckPacket packet = new PacketAckPacket(); packet.Header.Reliable = false; packet.Packets = blocks.ToArray(); ackCount = blocks.Count; SendPacket(packet); } return(ackCount); }
public void SendAcks(LLUDPClient udpClient) { uint ack; if (udpClient.PendingAcks.Dequeue(out ack)) { List <PacketAckPacket.PacketsBlock> blocks = new List <PacketAckPacket.PacketsBlock>(); PacketAckPacket.PacketsBlock block = new PacketAckPacket.PacketsBlock(); block.ID = ack; blocks.Add(block); while (udpClient.PendingAcks.Dequeue(out ack)) { block = new PacketAckPacket.PacketsBlock(); block.ID = ack; blocks.Add(block); } PacketAckPacket packet = new PacketAckPacket(); packet.Header.Reliable = false; packet.Packets = blocks.ToArray(); SendPacket(udpClient, packet, ThrottleOutPacketType.Unknown, true); } }
public void SendAcks(LLAgent agent) { const int MAX_ACKS_PER_PACKET = Byte.MaxValue; uint ack; if (agent.PendingAcks.TryDequeue(out ack)) { List <PacketAckPacket.PacketsBlock> blocks = new List <PacketAckPacket.PacketsBlock>(agent.PendingAcks.Count); PacketAckPacket.PacketsBlock block = new PacketAckPacket.PacketsBlock(); block.ID = ack; blocks.Add(block); int count = 1; while (count < MAX_ACKS_PER_PACKET && agent.PendingAcks.TryDequeue(out ack)) { block = new PacketAckPacket.PacketsBlock(); block.ID = ack; blocks.Add(block); ++count; } PacketAckPacket packet = new PacketAckPacket(); packet.Header.Reliable = false; packet.Packets = blocks.ToArray(); SendPacket(agent, packet, ThrottleCategory.Unknown, false); } }
/// <summary> /// Sends out pending acknowledgements /// </summary> private void SendAcks() { uint ack; if (PendingAcks.TryDequeue(out ack)) { Interlocked.Decrement(ref PendingAckCount); List<PacketAckPacket.PacketsBlock> blocks = new List<PacketAckPacket.PacketsBlock>(); PacketAckPacket.PacketsBlock block = new PacketAckPacket.PacketsBlock(); block.ID = ack; blocks.Add(block); while (PendingAcks.TryDequeue(out ack)) { Interlocked.Decrement(ref PendingAckCount); block = new PacketAckPacket.PacketsBlock(); block.ID = ack; blocks.Add(block); } PacketAckPacket packet = new PacketAckPacket(); packet.Header.Reliable = false; packet.Packets = blocks.ToArray(); SendPacket(packet); } }
public void SendAcks(LLUDPClient udpClient) { uint ack; if (udpClient.PendingAcks.Dequeue(out ack)) { List<PacketAckPacket.PacketsBlock> blocks = new List<PacketAckPacket.PacketsBlock>(); PacketAckPacket.PacketsBlock block = new PacketAckPacket.PacketsBlock(); block.ID = ack; blocks.Add(block); while (udpClient.PendingAcks.Dequeue(out ack)) { block = new PacketAckPacket.PacketsBlock(); block.ID = ack; blocks.Add(block); } PacketAckPacket packet = new PacketAckPacket(); packet.Header.Reliable = false; packet.Packets = blocks.ToArray(); SendPacket(udpClient, packet, ThrottleOutPacketType.Unknown, true, null); } }
/// <summary> /// Sends out pending acknowledgements /// </summary> /// <returns>Number of ACKs sent</returns> private int SendAcks() { uint ack; int ackCount = 0; if (PendingAcks.TryDequeue(out ack)) { List<PacketAckPacket.PacketsBlock> blocks = new List<PacketAckPacket.PacketsBlock>(); PacketAckPacket.PacketsBlock block = new PacketAckPacket.PacketsBlock(); block.ID = ack; blocks.Add(block); while (PendingAcks.TryDequeue(out ack)) { block = new PacketAckPacket.PacketsBlock(); block.ID = ack; blocks.Add(block); } PacketAckPacket packet = new PacketAckPacket(); packet.Header.Reliable = false; packet.Packets = blocks.ToArray(); ackCount = blocks.Count; SendPacket(packet); } return ackCount; }
public void SendAcks(LLUDPClient udpClient) { uint ack; if (udpClient.PendingAcks.TryDequeue(out ack)) { List<PacketAckPacket.PacketsBlock> blocks = new List<PacketAckPacket.PacketsBlock>(); PacketAckPacket.PacketsBlock block = new PacketAckPacket.PacketsBlock {ID = ack}; blocks.Add(block); while (udpClient.PendingAcks.TryDequeue(out ack)) { block = new PacketAckPacket.PacketsBlock {ID = ack}; blocks.Add(block); } PacketAckPacket packet = (PacketAckPacket) PacketPool.Instance.GetPacket(PacketType.PacketAck); packet.Header.Reliable = false; packet.Packets = blocks.ToArray(); SendPacket(udpClient, packet, ThrottleOutPacketType.OutBand, true, null, null); } }
public void SendAcks(LLAgent agent) { const int MAX_ACKS_PER_PACKET = Byte.MaxValue; uint ack; if (agent.PendingAcks.TryDequeue(out ack)) { List<PacketAckPacket.PacketsBlock> blocks = new List<PacketAckPacket.PacketsBlock>(agent.PendingAcks.Count); PacketAckPacket.PacketsBlock block = new PacketAckPacket.PacketsBlock(); block.ID = ack; blocks.Add(block); int count = 1; while (count < MAX_ACKS_PER_PACKET && agent.PendingAcks.TryDequeue(out ack)) { block = new PacketAckPacket.PacketsBlock(); block.ID = ack; blocks.Add(block); ++count; } PacketAckPacket packet = new PacketAckPacket(); packet.Header.Reliable = false; packet.Packets = blocks.ToArray(); SendPacket(agent, packet, ThrottleCategory.Unknown, false); } }