From c0852f0eb25dc9b8aa39fd3e1ecdf8e9dd0f2d1a Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Mon, 3 Aug 2015 17:14:42 -0700 Subject: [PATCH] Remove call to has pending datagrams --- libraries/networking/src/udt/Connection.cpp | 3 +-- libraries/networking/src/udt/Socket.cpp | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/libraries/networking/src/udt/Connection.cpp b/libraries/networking/src/udt/Connection.cpp index dab6c5b934..8bf3501590 100644 --- a/libraries/networking/src/udt/Connection.cpp +++ b/libraries/networking/src/udt/Connection.cpp @@ -283,9 +283,8 @@ bool Connection::processReceivedSequenceNumber(SequenceNumber sequenceNumber, in _receiveWindow.onProbePair1Arrival(); } else if (((uint32_t) sequenceNumber & 0xF) == 1) { _receiveWindow.onProbePair2Arrival(); - } else { - _receiveWindow.onPacketArrival(); } + _receiveWindow.onPacketArrival(); // If this is not the next sequence number, report loss if (sequenceNumber > _lastReceivedSequenceNumber + 1) { diff --git a/libraries/networking/src/udt/Socket.cpp b/libraries/networking/src/udt/Socket.cpp index 6a3a3d619f..dafe50d5c8 100644 --- a/libraries/networking/src/udt/Socket.cpp +++ b/libraries/networking/src/udt/Socket.cpp @@ -129,12 +129,12 @@ Connection& Socket::findOrCreateConnection(const HifiSockAddr& sockAddr) { } void Socket::readPendingDatagrams() { - while (_udpSocket.hasPendingDatagrams()) { + int packetSizeWithHeader = -1; + while ((packetSizeWithHeader = _udpSocket.pendingDatagramSize()) != -1) { // setup a HifiSockAddr to read into HifiSockAddr senderSockAddr; // setup a buffer to read the packet into - int packetSizeWithHeader = _udpSocket.pendingDatagramSize(); auto buffer = std::unique_ptr(new char[packetSizeWithHeader]); // pull the datagram