mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-06-22 13:40:05 +02:00
Don't move Connection class to changed address until it's used
This commit is contained in:
parent
b491d00c00
commit
4f11e46b5e
4 changed files with 11 additions and 10 deletions
|
@ -269,7 +269,7 @@ bool Connection::processReceivedSequenceNumber(SequenceNumber sequenceNumber, in
|
||||||
bool wasDuplicate = false;
|
bool wasDuplicate = false;
|
||||||
|
|
||||||
if (sequenceNumber > _lastReceivedSequenceNumber) {
|
if (sequenceNumber > _lastReceivedSequenceNumber) {
|
||||||
// Update largest recieved sequence number
|
// Update largest received sequence number
|
||||||
_lastReceivedSequenceNumber = sequenceNumber;
|
_lastReceivedSequenceNumber = sequenceNumber;
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, it could be a resend, try and remove it from the loss list
|
// Otherwise, it could be a resend, try and remove it from the loss list
|
||||||
|
@ -312,9 +312,7 @@ void Connection::processControl(ControlPacketPointer controlPacket) {
|
||||||
// We're already in a state where we've received a handshake ack, so we are likely in a state
|
// We're already in a state where we've received a handshake ack, so we are likely in a state
|
||||||
// where the other end expired our connection. Let's reset.
|
// where the other end expired our connection. Let's reset.
|
||||||
|
|
||||||
#ifdef UDT_CONNECTION_DEBUG
|
qCDebug(networking) << "Got HandshakeRequest from" << _destination << "while active, stopping SendQueue";
|
||||||
qCDebug(networking) << "Got HandshakeRequest from" << _destination << ", stopping SendQueue";
|
|
||||||
#endif
|
|
||||||
_hasReceivedHandshakeACK = false;
|
_hasReceivedHandshakeACK = false;
|
||||||
stopSendQueue();
|
stopSendQueue();
|
||||||
}
|
}
|
||||||
|
@ -333,7 +331,7 @@ void Connection::processACK(ControlPacketPointer controlPacket) {
|
||||||
// validate that this isn't a BS ACK
|
// validate that this isn't a BS ACK
|
||||||
if (ack > getSendQueue().getCurrentSequenceNumber()) {
|
if (ack > getSendQueue().getCurrentSequenceNumber()) {
|
||||||
// in UDT they specifically break the connection here - do we want to do anything?
|
// in UDT they specifically break the connection here - do we want to do anything?
|
||||||
Q_ASSERT_X(false, "Connection::processACK", "ACK recieved higher than largest sent sequence number");
|
Q_ASSERT_X(false, "Connection::processACK", "ACK received higher than largest sent sequence number");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,7 @@ public:
|
||||||
void setMaxBandwidth(int maxBandwidth);
|
void setMaxBandwidth(int maxBandwidth);
|
||||||
|
|
||||||
void sendHandshakeRequest();
|
void sendHandshakeRequest();
|
||||||
|
bool hasReceivedHandshake() const { return _hasReceivedHandshake; }
|
||||||
|
|
||||||
void recordSentUnreliablePackets(int wireSize, int payloadSize);
|
void recordSentUnreliablePackets(int wireSize, int payloadSize);
|
||||||
void recordReceivedUnreliablePackets(int wireSize, int payloadSize);
|
void recordReceivedUnreliablePackets(int wireSize, int payloadSize);
|
||||||
|
|
|
@ -261,7 +261,7 @@ Connection* Socket::findOrCreateConnection(const HifiSockAddr& sockAddr, bool fi
|
||||||
// we did not have a matching connection, time to see if we should make one
|
// we did not have a matching connection, time to see if we should make one
|
||||||
|
|
||||||
if (filterCreate && _connectionCreationFilterOperator && !_connectionCreationFilterOperator(sockAddr)) {
|
if (filterCreate && _connectionCreationFilterOperator && !_connectionCreationFilterOperator(sockAddr)) {
|
||||||
// the connection creation filter did not allow us to create a new connection
|
// the connection creation filter did not allow us to create a new connectionclientHandshakeRequestComplete
|
||||||
#ifdef UDT_CONNECTION_DEBUG
|
#ifdef UDT_CONNECTION_DEBUG
|
||||||
qCDebug(networking) << "Socket::findOrCreateConnection refusing to create Connection class for" << sockAddr
|
qCDebug(networking) << "Socket::findOrCreateConnection refusing to create Connection class for" << sockAddr
|
||||||
<< "due to connection creation filter";
|
<< "due to connection creation filter";
|
||||||
|
@ -548,12 +548,14 @@ void Socket::handleRemoteAddressChange(HifiSockAddr previousAddress, HifiSockAdd
|
||||||
Lock connectionsLock(_connectionsHashMutex);
|
Lock connectionsLock(_connectionsHashMutex);
|
||||||
|
|
||||||
const auto connectionIter = _connectionsHash.find(previousAddress);
|
const auto connectionIter = _connectionsHash.find(previousAddress);
|
||||||
if (connectionIter != _connectionsHash.end()) {
|
// Don't move classes that are unused so far.
|
||||||
|
if (connectionIter != _connectionsHash.end() && connectionIter->second->hasReceivedHandshake()) {
|
||||||
auto connection = move(connectionIter->second);
|
auto connection = move(connectionIter->second);
|
||||||
_connectionsHash.erase(connectionIter);
|
_connectionsHash.erase(connectionIter);
|
||||||
connection->setDestinationAddress(currentAddress);
|
connection->setDestinationAddress(currentAddress);
|
||||||
_connectionsHash[currentAddress] = move(connection);
|
_connectionsHash[currentAddress] = move(connection);
|
||||||
connectionsLock.unlock();
|
connectionsLock.unlock();
|
||||||
|
qCDebug(networking) << "Moved Connection class from" << previousAddress << "to" << currentAddress;
|
||||||
|
|
||||||
Lock sequenceNumbersLock(_unreliableSequenceNumbersMutex);
|
Lock sequenceNumbersLock(_unreliableSequenceNumbersMutex);
|
||||||
const auto sequenceNumbersIter = _unreliableSequenceNumbers.find(previousAddress);
|
const auto sequenceNumbersIter = _unreliableSequenceNumbers.find(previousAddress);
|
||||||
|
|
Loading…
Reference in a new issue