use of org.dragonet.raknet.protocol.packet.DATA_PACKET_0 in project Dragonet-Legacy by DragonetMC.
the class Session method addToQueue.
private void addToQueue(EncapsulatedPacket pk, int flags) throws Exception {
int priority = flags & 0b0000111;
if (pk.needACK && pk.messageIndex != null) {
Map<Integer, Integer> map;
if (!this.needACK.containsKey(pk.identifierACK)) {
this.needACK.put(pk.identifierACK, new HashMap<Integer, Integer>());
}
this.needACK.get(pk.identifierACK).put(pk.messageIndex, pk.messageIndex);
}
if (priority == RakNet.PRIORITY_IMMEDIATE) {
//Skip queues
DataPacket packet = new DATA_PACKET_0();
packet.seqNumber = this.sendSeqNumber++;
if (pk.needACK) {
packet.packets.add(pk.clone());
pk.needACK = false;
} else {
packet.packets.add(pk.toBinary());
}
this.sendPacket(packet);
packet.sendTime = System.currentTimeMillis();
this.recoveryQueue.put(packet.seqNumber, packet);
return;
}
int length = this.sendQueue.length();
if (length + pk.getTotalLength() > this.mtuSize) {
this.sendQueue();
}
if (pk.needACK) {
this.sendQueue.packets.add(pk.clone());
pk.needACK = false;
} else {
this.sendQueue.packets.add(pk.toBinary());
}
}
Aggregations