Merge branch 'atp' of https://github.com/birarda/hifi into protocol

This commit is contained in:
Atlante45 2015-07-30 15:58:28 -07:00
commit bcff9730f6
4 changed files with 6 additions and 7 deletions

View file

@ -228,9 +228,9 @@ SequenceNumber Connection::nextACK() const {
bool Connection::processReceivedSequenceNumber(SequenceNumber sequenceNumber) {
// check if this is a packet pair we should estimate bandwidth from, or just a regular packet
if (((uint32_t) sequenceNumber & 0xFF) == 0) {
if (((uint32_t) sequenceNumber & 0xF) == 0) {
_receiveWindow.onProbePair1Arrival();
} else if (((uint32_t) sequenceNumber & 0xFF) == 1) {
} else if (((uint32_t) sequenceNumber & 0xF) == 1) {
_receiveWindow.onProbePair2Arrival();
} else {
_receiveWindow.onPacketArrival();

View file

@ -174,7 +174,7 @@ void SendQueue::loop() {
sequenceNumber = getNextSequenceNumber();
// the first packet in the pair is every 16 (rightmost 16 bits = 0) packets
if (((uint32_t) sequenceNumber & 0xFF) == 0) {
if (((uint32_t) sequenceNumber & 0xF) == 0) {
shouldSendSecondOfPair = true;
}
}

View file

@ -24,8 +24,6 @@ using namespace udt;
Socket::Socket(QObject* parent) :
QObject(parent)
{
setSystemBufferSizes();
connect(&_udpSocket, &QUdpSocket::readyRead, this, &Socket::readPendingDatagrams);
// make sure our synchronization method is called every SYN interval
@ -39,7 +37,7 @@ void Socket::rebind() {
quint16 oldPort = _udpSocket.localPort();
_udpSocket.close();
_udpSocket.bind(QHostAddress::AnyIPv4, oldPort);
bind(QHostAddress::AnyIPv4, oldPort);
}
void Socket::setSystemBufferSizes() {
@ -63,6 +61,7 @@ void Socket::setSystemBufferSizes() {
int oldBufferSize = _udpSocket.socketOption(bufferOpt).toInt();
if (oldBufferSize < numBytes) {
_udpSocket.setSocketOption(bufferOpt, QVariant(numBytes));
int newBufferSize = _udpSocket.socketOption(bufferOpt).toInt();
qCDebug(networking) << "Changed socket" << bufferTypeString << "buffer size from" << oldBufferSize << "to"

View file

@ -50,7 +50,7 @@ public:
qint64 writeDatagram(const char* data, qint64 size, const HifiSockAddr& sockAddr);
qint64 writeDatagram(const QByteArray& datagram, const HifiSockAddr& sockAddr);
void bind(const QHostAddress& address, quint16 port = 0) { _udpSocket.bind(address, port); }
void bind(const QHostAddress& address, quint16 port = 0) { _udpSocket.bind(address, port); setSystemBufferSizes(); }
void rebind();
void setPacketFilterOperator(PacketFilterOperator filterOperator) { _packetFilterOperator = filterOperator; }