fix for HifiSockAddr lookup for ice server from DomainHandler

This commit is contained in:
Stephen Birarda 2014-11-04 13:53:56 -08:00
parent d46f775f20
commit beb350d1e7
2 changed files with 16 additions and 11 deletions

View file

@ -14,6 +14,7 @@
#include <QtCore/QJsonDocument>
#include "Assignment.h"
#include "HifiSockAddr.h"
#include "NodeList.h"
#include "PacketHeaders.h"
#include "UserActivityLogger.h"
@ -144,7 +145,10 @@ void DomainHandler::setIceServerHostnameAndID(const QString& iceServerHostname,
hardReset();
_iceDomainID = id;
_iceServerSockAddr = HifiSockAddr(iceServerHostname, ICE_SERVER_DEFAULT_PORT);
HifiSockAddr* replaceableSockAddr = &_iceServerSockAddr;
replaceableSockAddr->~HifiSockAddr();
replaceableSockAddr = new (replaceableSockAddr) HifiSockAddr(iceServerHostname, ICE_SERVER_DEFAULT_PORT);
// refresh our ICE client UUID to something new
_iceClientID = QUuid::createUuid();

View file

@ -31,9 +31,17 @@ HifiSockAddr::HifiSockAddr(const QHostAddress& address, quint16 port) :
}
HifiSockAddr::HifiSockAddr(const HifiSockAddr& otherSockAddr) {
_address = otherSockAddr._address;
_port = otherSockAddr._port;
HifiSockAddr::HifiSockAddr(const HifiSockAddr& otherSockAddr) :
_address(otherSockAddr._address),
_port(otherSockAddr._port)
{
}
HifiSockAddr& HifiSockAddr::operator=(const HifiSockAddr& rhsSockAddr) {
HifiSockAddr temp(rhsSockAddr);
swap(temp);
return *this;
}
HifiSockAddr::HifiSockAddr(const QString& hostname, quint16 hostOrderPort, bool shouldBlockForLookup) :
@ -64,13 +72,6 @@ HifiSockAddr::HifiSockAddr(const sockaddr* sockaddr) {
}
}
HifiSockAddr& HifiSockAddr::operator=(const HifiSockAddr& rhsSockAddr) {
_address = rhsSockAddr._address;
_port = rhsSockAddr._port;
return *this;
}
void HifiSockAddr::swap(HifiSockAddr& otherSockAddr) {
using std::swap;