highfidelity/hifi — pull request #3010 by wangyix (2014-06-10 23:14:05+00:00)
Title: NACK packets are not sent to nodes with unprocessed packets; re-sent packets will be counted towards PPS

NACK packets are not sent to nodes with unprocessed packets:

Cause: A NACK packet may contain sequence numbers of late packets that have arrived but haven't been processed, in which case they do NOT need to be re-sent.

Fix: A QHash was added to base class ReceivedPacketProcessor that keeps track of how many received packets are waiting to be processed from each sending node. This is used by sendNack() so that NACKs are only sent to nodes that have no packets waiting in the client's receive-buffer.

Testing: None yet, but from looking at octree packet statistics, the client doesn't seem to receive any duplicate packets.

Re-sent packets will be counted towards PPS:

Cause: OctreeSendThread's resendNackedPackets() did not count the re-sent packets towards the PPS, which means more packets are sent per time unit than desired by the client or server may be sent.

Fix: resendNackedPackets() was moved into PacketDistributor() so those packets could also be counted towards the PPS as well as other stats.

Testing: None yet.

Also changed VoxelPacketProcessor to OctreePacketProcessor and changed the _destinationNode field of NetworkPacket to _sendingNode to match their actual purposes. Related identifiers (getters and setters) were updated to reflect this change.