mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 22:39:18 +02:00
Plumb down change of destination address
This commit is contained in:
parent
50965f1916
commit
1265531f79
5 changed files with 23 additions and 0 deletions
|
@ -114,6 +114,7 @@ SendQueue& Connection::getSendQueue() {
|
||||||
QObject::connect(_sendQueue.get(), &SendQueue::packetRetransmitted, this, &Connection::recordRetransmission);
|
QObject::connect(_sendQueue.get(), &SendQueue::packetRetransmitted, this, &Connection::recordRetransmission);
|
||||||
QObject::connect(_sendQueue.get(), &SendQueue::queueInactive, this, &Connection::queueInactive);
|
QObject::connect(_sendQueue.get(), &SendQueue::queueInactive, this, &Connection::queueInactive);
|
||||||
QObject::connect(_sendQueue.get(), &SendQueue::timeout, this, &Connection::queueTimeout);
|
QObject::connect(_sendQueue.get(), &SendQueue::timeout, this, &Connection::queueTimeout);
|
||||||
|
QObject::connect(this, &Connection::destinationAddressChange, _sendQueue.get(), &SendQueue::updateDestinationAddress);
|
||||||
|
|
||||||
|
|
||||||
// set defaults on the send queue from our congestion control object and estimatedTimeout()
|
// set defaults on the send queue from our congestion control object and estimatedTimeout()
|
||||||
|
@ -485,3 +486,10 @@ std::unique_ptr<Packet> PendingReceivedMessage::removeNextPacket() {
|
||||||
}
|
}
|
||||||
return std::unique_ptr<Packet>();
|
return std::unique_ptr<Packet>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Connection::setDestinationAddress(const HifiSockAddr& destination) {
|
||||||
|
if (_destination != destination) {
|
||||||
|
_destination = destination;
|
||||||
|
emit destinationAddressChange(destination);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -76,10 +76,12 @@ public:
|
||||||
|
|
||||||
void recordSentUnreliablePackets(int wireSize, int payloadSize);
|
void recordSentUnreliablePackets(int wireSize, int payloadSize);
|
||||||
void recordReceivedUnreliablePackets(int wireSize, int payloadSize);
|
void recordReceivedUnreliablePackets(int wireSize, int payloadSize);
|
||||||
|
void setDestinationAddress(const HifiSockAddr& destination);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void packetSent();
|
void packetSent();
|
||||||
void receiverHandshakeRequestComplete(const HifiSockAddr& sockAddr);
|
void receiverHandshakeRequestComplete(const HifiSockAddr& sockAddr);
|
||||||
|
void destinationAddressChange(HifiSockAddr currentAddress);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void recordSentPackets(int wireSize, int payloadSize, SequenceNumber seqNum, p_high_resolution_clock::time_point timePoint);
|
void recordSentPackets(int wireSize, int payloadSize, SequenceNumber seqNum, p_high_resolution_clock::time_point timePoint);
|
||||||
|
|
|
@ -557,3 +557,7 @@ void SendQueue::deactivate() {
|
||||||
bool SendQueue::isFlowWindowFull() const {
|
bool SendQueue::isFlowWindowFull() const {
|
||||||
return seqlen(SequenceNumber { (uint32_t) _lastACKSequenceNumber }, _currentSequenceNumber) > _flowWindowSize;
|
return seqlen(SequenceNumber { (uint32_t) _lastACKSequenceNumber }, _currentSequenceNumber) > _flowWindowSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SendQueue::updateDestinationAddress(HifiSockAddr newAddress) {
|
||||||
|
_destination = newAddress;
|
||||||
|
}
|
||||||
|
|
|
@ -75,6 +75,7 @@ public slots:
|
||||||
void ack(SequenceNumber ack);
|
void ack(SequenceNumber ack);
|
||||||
void fastRetransmit(SequenceNumber ack);
|
void fastRetransmit(SequenceNumber ack);
|
||||||
void handshakeACK();
|
void handshakeACK();
|
||||||
|
void updateDestinationAddress(HifiSockAddr newAddress);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void packetSent(int wireSize, int payloadSize, SequenceNumber seqNum, p_high_resolution_clock::time_point timePoint);
|
void packetSent(int wireSize, int payloadSize, SequenceNumber seqNum, p_high_resolution_clock::time_point timePoint);
|
||||||
|
|
|
@ -540,7 +540,15 @@ void Socket::handleStateChanged(QAbstractSocket::SocketState socketState) {
|
||||||
|
|
||||||
void Socket::handleRemoteAddressChange(HifiSockAddr previousAddress, HifiSockAddr currentAddress) {
|
void Socket::handleRemoteAddressChange(HifiSockAddr previousAddress, HifiSockAddr currentAddress) {
|
||||||
Lock connectionsLock(_connectionsHashMutex);
|
Lock connectionsLock(_connectionsHashMutex);
|
||||||
|
_connectionsHash.erase(currentAddress);
|
||||||
|
|
||||||
|
const auto connectionIter = _connectionsHash.find(currentAddress);
|
||||||
|
if (connectionIter != _connectionsHash.end()) {
|
||||||
|
auto connection = std::move(connectionIter->second);
|
||||||
|
_connectionsHash.erase(connectionIter);
|
||||||
|
connection->setDestinationAddress(currentAddress);
|
||||||
|
_connectionsHash[currentAddress] = std::move(connection);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (PR_BUILD || DEV_BUILD)
|
#if (PR_BUILD || DEV_BUILD)
|
||||||
|
|
Loading…
Reference in a new issue