mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:24:00 +02:00
HifiSockAddr have object names
This commit is contained in:
parent
116ff17fcf
commit
b8085086c6
9 changed files with 36 additions and 9 deletions
|
@ -95,6 +95,7 @@ AssignmentClient::AssignmentClient(Assignment::Type requestAssignmentType, QStri
|
|||
}
|
||||
|
||||
_assignmentServerSocket = HifiSockAddr(_assignmentServerHostname, assignmentServerPort, true);
|
||||
_assignmentServerSocket.setObjectName("AssigmentServer");
|
||||
nodeList->setAssignmentServerSocket(_assignmentServerSocket);
|
||||
|
||||
qDebug() << "Assignment server socket is" << _assignmentServerSocket;
|
||||
|
@ -119,6 +120,7 @@ AssignmentClient::AssignmentClient(Assignment::Type requestAssignmentType, QStri
|
|||
// did we get an assignment-client monitor port?
|
||||
if (assignmentMonitorPort > 0) {
|
||||
_assignmentClientMonitorSocket = HifiSockAddr(DEFAULT_ASSIGNMENT_CLIENT_MONITOR_HOSTNAME, assignmentMonitorPort);
|
||||
_assignmentClientMonitorSocket.setObjectName("AssignmentClientMonitor");
|
||||
|
||||
qDebug() << "Assignment-client monitor socket is" << _assignmentClientMonitorSocket;
|
||||
|
||||
|
|
|
@ -37,6 +37,8 @@ DomainHandler::DomainHandler(QObject* parent) :
|
|||
_settingsObject(),
|
||||
_failedSettingsRequests(0)
|
||||
{
|
||||
_sockAddr.setObjectName("DomainServer");
|
||||
|
||||
// if we get a socket that make sure our NetworkPeer ping timer stops
|
||||
connect(this, &DomainHandler::completedSocketDiscovery, &_icePeer, &NetworkPeer::stopPingTimer);
|
||||
}
|
||||
|
@ -145,6 +147,7 @@ void DomainHandler::setIceServerHostnameAndID(const QString& iceServerHostname,
|
|||
HifiSockAddr* replaceableSockAddr = &_iceServerSockAddr;
|
||||
replaceableSockAddr->~HifiSockAddr();
|
||||
replaceableSockAddr = new (replaceableSockAddr) HifiSockAddr(iceServerHostname, ICE_SERVER_DEFAULT_PORT);
|
||||
_iceServerSockAddr.setObjectName("IceServer");
|
||||
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
||||
|
|
|
@ -33,16 +33,16 @@ HifiSockAddr::HifiSockAddr(const QHostAddress& address, quint16 port) :
|
|||
}
|
||||
|
||||
HifiSockAddr::HifiSockAddr(const HifiSockAddr& otherSockAddr) :
|
||||
QObject(),
|
||||
_address(otherSockAddr._address),
|
||||
_port(otherSockAddr._port)
|
||||
{
|
||||
|
||||
setObjectName(otherSockAddr.objectName());
|
||||
}
|
||||
|
||||
HifiSockAddr& HifiSockAddr::operator=(const HifiSockAddr& rhsSockAddr) {
|
||||
HifiSockAddr temp(rhsSockAddr);
|
||||
swap(temp);
|
||||
setObjectName(rhsSockAddr.objectName());
|
||||
_address = rhsSockAddr._address;
|
||||
_port = rhsSockAddr._port;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -76,9 +76,14 @@ HifiSockAddr::HifiSockAddr(const sockaddr* sockaddr) {
|
|||
|
||||
void HifiSockAddr::swap(HifiSockAddr& otherSockAddr) {
|
||||
using std::swap;
|
||||
|
||||
|
||||
swap(_address, otherSockAddr._address);
|
||||
swap(_port, otherSockAddr._port);
|
||||
|
||||
// Swap objects name
|
||||
auto temp = otherSockAddr.objectName();
|
||||
otherSockAddr.setObjectName(objectName());
|
||||
setObjectName(temp);
|
||||
}
|
||||
|
||||
bool HifiSockAddr::operator==(const HifiSockAddr& rhsSockAddr) const {
|
||||
|
|
|
@ -57,7 +57,9 @@ void NetworkPeer::setPublicSocket(const HifiSockAddr& publicSocket) {
|
|||
|
||||
bool wasOldSocketNull = _publicSocket.isNull();
|
||||
|
||||
auto temp = _publicSocket.objectName();
|
||||
_publicSocket = publicSocket;
|
||||
_publicSocket.setObjectName(temp);
|
||||
|
||||
if (!wasOldSocketNull) {
|
||||
qCDebug(networking) << "Public socket change for node" << *this;
|
||||
|
@ -74,7 +76,9 @@ void NetworkPeer::setLocalSocket(const HifiSockAddr& localSocket) {
|
|||
|
||||
bool wasOldSocketNull = _localSocket.isNull();
|
||||
|
||||
auto temp = _localSocket.objectName();
|
||||
_localSocket = localSocket;
|
||||
_localSocket.setObjectName(temp);
|
||||
|
||||
if (!wasOldSocketNull) {
|
||||
qCDebug(networking) << "Local socket change for node" << *this;
|
||||
|
@ -91,7 +95,9 @@ void NetworkPeer::setSymmetricSocket(const HifiSockAddr& symmetricSocket) {
|
|||
|
||||
bool wasOldSocketNull = _symmetricSocket.isNull();
|
||||
|
||||
auto temp = _symmetricSocket.objectName();
|
||||
_symmetricSocket = symmetricSocket;
|
||||
_symmetricSocket.setObjectName(temp);
|
||||
|
||||
if (!wasOldSocketNull) {
|
||||
qCDebug(networking) << "Symmetric socket change for node" << *this;
|
||||
|
|
|
@ -55,13 +55,23 @@ Node::Node(const QUuid& uuid, NodeType_t type, const HifiSockAddr& publicSocket,
|
|||
_canAdjustLocks(canAdjustLocks),
|
||||
_canRez(canRez)
|
||||
{
|
||||
|
||||
// Update socket's object name
|
||||
setType(_type);
|
||||
}
|
||||
|
||||
Node::~Node() {
|
||||
delete _linkedData;
|
||||
}
|
||||
|
||||
void Node::setType(char type) {
|
||||
_type = type;
|
||||
|
||||
auto typeString = NodeType::getNodeTypeName(type);
|
||||
_publicSocket.setObjectName(typeString);
|
||||
_localSocket.setObjectName(typeString);
|
||||
_symmetricSocket.setObjectName(typeString);
|
||||
}
|
||||
|
||||
void Node::updateClockSkewUsec(int clockSkewSample) {
|
||||
_clockSkewMovingPercentile.updatePercentile((float)clockSkewSample);
|
||||
_clockSkewUsec = (int)_clockSkewMovingPercentile.getValueAtPercentile();
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
bool operator!=(const Node& otherNode) const { return !(*this == otherNode); }
|
||||
|
||||
char getType() const { return _type; }
|
||||
void setType(char type) { _type = type; }
|
||||
void setType(char type);
|
||||
|
||||
const QUuid& getConnectionSecret() const { return _connectionSecret; }
|
||||
void setConnectionSecret(const QUuid& connectionSecret) { _connectionSecret = connectionSecret; }
|
||||
|
|
|
@ -30,7 +30,7 @@ std::unique_ptr<SendQueue> SendQueue::create(Socket* socket, HifiSockAddr dest)
|
|||
|
||||
// Setup queue private thread
|
||||
QThread* thread = new QThread();
|
||||
thread->setObjectName("Networking: SendQueue"); // Name thread for easier debug
|
||||
thread->setObjectName("Networking: SendQueue " + dest.objectName()); // Name thread for easier debug
|
||||
connect(queue.get(), &QObject::destroyed, thread, &QThread::quit); // Thread auto cleanup
|
||||
connect(thread, &QThread::finished, thread, &QThread::deleteLater); // Thread auto cleanup
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <QtCore/QThread>
|
||||
|
||||
#include "../NetworkLogging.h"
|
||||
#include "Connection.h"
|
||||
#include "ControlPacket.h"
|
||||
#include "Packet.h"
|
||||
|
||||
|
|
|
@ -23,11 +23,11 @@
|
|||
|
||||
#include "../HifiSockAddr.h"
|
||||
#include "CongestionControl.h"
|
||||
#include "Connection.h"
|
||||
|
||||
namespace udt {
|
||||
|
||||
class BasePacket;
|
||||
class Connection;
|
||||
class ControlSender;
|
||||
class Packet;
|
||||
class SequenceNumber;
|
||||
|
|
Loading…
Reference in a new issue