add a control packet type for LightACK

This commit is contained in:
Stephen Birarda 2015-08-28 07:31:44 -07:00
parent 28d9610bd4
commit cf98d4a8f7
2 changed files with 7 additions and 6 deletions

View file

@ -237,7 +237,7 @@ void Connection::sendLightACK() {
// create the light ACK packet, make it static so we can re-use it // create the light ACK packet, make it static so we can re-use it
static const int LIGHT_ACK_PACKET_PAYLOAD_BYTES = sizeof(SequenceNumber); static const int LIGHT_ACK_PACKET_PAYLOAD_BYTES = sizeof(SequenceNumber);
static auto lightACKPacket = ControlPacket::create(ControlPacket::ACK, LIGHT_ACK_PACKET_PAYLOAD_BYTES); static auto lightACKPacket = ControlPacket::create(ControlPacket::LightACK, LIGHT_ACK_PACKET_PAYLOAD_BYTES);
// reset the lightACKPacket before we go to write the ACK to it // reset the lightACKPacket before we go to write the ACK to it
lightACKPacket->reset(); lightACKPacket->reset();
@ -407,13 +407,13 @@ void Connection::processControl(std::unique_ptr<ControlPacket> controlPacket) {
switch (controlPacket->getType()) { switch (controlPacket->getType()) {
case ControlPacket::ACK: case ControlPacket::ACK:
if (_hasReceivedHandshakeACK) { if (_hasReceivedHandshakeACK) {
if (controlPacket->getPayloadSize() == sizeof(SequenceNumber)) { processACK(move(controlPacket));
processLightACK(move(controlPacket));
} else {
processACK(move(controlPacket));
}
} }
break; break;
case ControlPacket::LightACK:
if (_hasReceivedHandshakeACK) {
processLightACK(move(controlPacket));
}
case ControlPacket::ACK2: case ControlPacket::ACK2:
if (_hasReceivedHandshake) { if (_hasReceivedHandshake) {
processACK2(move(controlPacket)); processACK2(move(controlPacket));

View file

@ -29,6 +29,7 @@ public:
enum Type : uint16_t { enum Type : uint16_t {
ACK, ACK,
ACK2, ACK2,
LightACK,
NAK, NAK,
TimeoutNAK, TimeoutNAK,
Handshake, Handshake,