mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 13:30:33 +02:00
Use invalid port to signal no value passed
This commit is contained in:
parent
12eb65c0c4
commit
eb007b24cd
8 changed files with 19 additions and 19 deletions
|
@ -368,11 +368,11 @@ void DomainServer::setupNodeListAndAssignments() {
|
||||||
const QString CUSTOM_LOCAL_PORT_OPTION = "metaverse.local_port";
|
const QString CUSTOM_LOCAL_PORT_OPTION = "metaverse.local_port";
|
||||||
|
|
||||||
QVariant localPortValue = _settingsManager.valueOrDefaultValueForKeyPath(CUSTOM_LOCAL_PORT_OPTION);
|
QVariant localPortValue = _settingsManager.valueOrDefaultValueForKeyPath(CUSTOM_LOCAL_PORT_OPTION);
|
||||||
unsigned short domainServerPort = (unsigned short) localPortValue.toUInt();
|
int domainServerPort = localPortValue.toInt();
|
||||||
|
|
||||||
QVariantMap& settingsMap = _settingsManager.getSettingsMap();
|
QVariantMap& settingsMap = _settingsManager.getSettingsMap();
|
||||||
|
|
||||||
unsigned short domainServerDTLSPort = 0;
|
int domainServerDTLSPort = INVALID_PORT;
|
||||||
|
|
||||||
if (_isUsingDTLS) {
|
if (_isUsingDTLS) {
|
||||||
domainServerDTLSPort = DEFAULT_DOMAIN_SERVER_DTLS_PORT;
|
domainServerDTLSPort = DEFAULT_DOMAIN_SERVER_DTLS_PORT;
|
||||||
|
|
|
@ -401,12 +401,10 @@ static const QString STATE_GROUNDED = "Grounded";
|
||||||
static const QString STATE_NAV_FOCUSED = "NavigationFocused";
|
static const QString STATE_NAV_FOCUSED = "NavigationFocused";
|
||||||
|
|
||||||
bool setupEssentials(int& argc, char** argv) {
|
bool setupEssentials(int& argc, char** argv) {
|
||||||
unsigned int listenPort = 0; // bind to an ephemeral port by default
|
|
||||||
const char** constArgv = const_cast<const char**>(argv);
|
const char** constArgv = const_cast<const char**>(argv);
|
||||||
const char* portStr = getCmdOption(argc, constArgv, "--listenPort");
|
const char* portStr = getCmdOption(argc, constArgv, "--listenPort");
|
||||||
if (portStr) {
|
const int listenPort = portStr ? atoi(portStr) : INVALID_PORT;
|
||||||
listenPort = atoi(portStr);
|
|
||||||
}
|
|
||||||
// Set build version
|
// Set build version
|
||||||
QCoreApplication::setApplicationVersion(BuildInfo::VERSION);
|
QCoreApplication::setApplicationVersion(BuildInfo::VERSION);
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ const std::set<NodeType_t> SOLO_NODE_TYPES = {
|
||||||
NodeType::AudioMixer
|
NodeType::AudioMixer
|
||||||
};
|
};
|
||||||
|
|
||||||
LimitedNodeList::LimitedNodeList(unsigned short socketListenPort, unsigned short dtlsListenPort) :
|
LimitedNodeList::LimitedNodeList(int socketListenPort, int dtlsListenPort) :
|
||||||
_sessionUUID(),
|
_sessionUUID(),
|
||||||
_nodeHash(),
|
_nodeHash(),
|
||||||
_nodeMutex(QReadWriteLock::Recursive),
|
_nodeMutex(QReadWriteLock::Recursive),
|
||||||
|
@ -66,11 +66,11 @@ LimitedNodeList::LimitedNodeList(unsigned short socketListenPort, unsigned short
|
||||||
}
|
}
|
||||||
|
|
||||||
qRegisterMetaType<ConnectionStep>("ConnectionStep");
|
qRegisterMetaType<ConnectionStep>("ConnectionStep");
|
||||||
auto port = (socketListenPort != 0) ? socketListenPort : LIMITED_NODELIST_LOCAL_PORT.get();
|
auto port = (socketListenPort != INVALID_PORT) ? socketListenPort : LIMITED_NODELIST_LOCAL_PORT.get();
|
||||||
_nodeSocket.bind(QHostAddress::AnyIPv4, port);
|
_nodeSocket.bind(QHostAddress::AnyIPv4, port);
|
||||||
qCDebug(networking) << "NodeList socket is listening on" << _nodeSocket.localPort();
|
qCDebug(networking) << "NodeList socket is listening on" << _nodeSocket.localPort();
|
||||||
|
|
||||||
if (dtlsListenPort > 0) {
|
if (dtlsListenPort != INVALID_PORT) {
|
||||||
// only create the DTLS socket during constructor if a custom port is passed
|
// only create the DTLS socket during constructor if a custom port is passed
|
||||||
_dtlsSocket = new QUdpSocket(this);
|
_dtlsSocket = new QUdpSocket(this);
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,8 @@
|
||||||
#include "udt/Socket.h"
|
#include "udt/Socket.h"
|
||||||
#include "UUIDHasher.h"
|
#include "UUIDHasher.h"
|
||||||
|
|
||||||
|
const int INVALID_PORT = -1;
|
||||||
|
|
||||||
const quint64 NODE_SILENCE_THRESHOLD_MSECS = 5 * 1000;
|
const quint64 NODE_SILENCE_THRESHOLD_MSECS = 5 * 1000;
|
||||||
|
|
||||||
extern const std::set<NodeType_t> SOLO_NODE_TYPES;
|
extern const std::set<NodeType_t> SOLO_NODE_TYPES;
|
||||||
|
@ -270,9 +272,9 @@ protected slots:
|
||||||
void errorTestingLocalSocket();
|
void errorTestingLocalSocket();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
LimitedNodeList(unsigned short socketListenPort = 0, unsigned short dtlsListenPort = 0);
|
LimitedNodeList(int socketListenPort = INVALID_PORT, int dtlsListenPort = INVALID_PORT);
|
||||||
LimitedNodeList(LimitedNodeList const&); // Don't implement, needed to avoid copies of singleton
|
LimitedNodeList(LimitedNodeList const&) = delete; // Don't implement, needed to avoid copies of singleton
|
||||||
void operator=(LimitedNodeList const&); // Don't implement, needed to avoid copies of singleton
|
void operator=(LimitedNodeList const&) = delete; // Don't implement, needed to avoid copies of singleton
|
||||||
|
|
||||||
qint64 sendPacket(std::unique_ptr<NLPacket> packet, const Node& destinationNode,
|
qint64 sendPacket(std::unique_ptr<NLPacket> packet, const Node& destinationNode,
|
||||||
const HifiSockAddr& overridenSockAddr);
|
const HifiSockAddr& overridenSockAddr);
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
const int KEEPALIVE_PING_INTERVAL_MS = 1000;
|
const int KEEPALIVE_PING_INTERVAL_MS = 1000;
|
||||||
|
|
||||||
NodeList::NodeList(char newOwnerType, unsigned short socketListenPort, unsigned short dtlsListenPort) :
|
NodeList::NodeList(char newOwnerType, int socketListenPort, int dtlsListenPort) :
|
||||||
LimitedNodeList(socketListenPort, dtlsListenPort),
|
LimitedNodeList(socketListenPort, dtlsListenPort),
|
||||||
_ownerType(newOwnerType),
|
_ownerType(newOwnerType),
|
||||||
_nodeTypesOfInterest(),
|
_nodeTypesOfInterest(),
|
||||||
|
|
|
@ -116,10 +116,10 @@ private slots:
|
||||||
void maybeSendIgnoreSetToNode(SharedNodePointer node);
|
void maybeSendIgnoreSetToNode(SharedNodePointer node);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NodeList() : LimitedNodeList(0, 0) { assert(false); } // Not implemented, needed for DependencyManager templates compile
|
NodeList() : LimitedNodeList(INVALID_PORT, INVALID_PORT) { assert(false); } // Not implemented, needed for DependencyManager templates compile
|
||||||
NodeList(char ownerType, unsigned short socketListenPort = 0, unsigned short dtlsListenPort = 0);
|
NodeList(char ownerType, int socketListenPort = INVALID_PORT, int dtlsListenPort = INVALID_PORT);
|
||||||
NodeList(NodeList const&); // Don't implement, needed to avoid copies of singleton
|
NodeList(NodeList const&) = delete; // Don't implement, needed to avoid copies of singleton
|
||||||
void operator=(NodeList const&); // Don't implement, needed to avoid copies of singleton
|
void operator=(NodeList const&) = delete; // Don't implement, needed to avoid copies of singleton
|
||||||
|
|
||||||
void processDomainServerAuthRequest(const QByteArray& packet);
|
void processDomainServerAuthRequest(const QByteArray& packet);
|
||||||
void requestAuthForDomainServer();
|
void requestAuthForDomainServer();
|
||||||
|
|
|
@ -503,7 +503,7 @@ public:
|
||||||
DependencyManager::registerInheritance<LimitedNodeList, NodeList>();
|
DependencyManager::registerInheritance<LimitedNodeList, NodeList>();
|
||||||
DependencyManager::registerInheritance<SpatialParentFinder, ParentFinder>();
|
DependencyManager::registerInheritance<SpatialParentFinder, ParentFinder>();
|
||||||
DependencyManager::set<AddressManager>();
|
DependencyManager::set<AddressManager>();
|
||||||
DependencyManager::set<NodeList>(NodeType::Agent, 0);
|
DependencyManager::set<NodeList>(NodeType::Agent);
|
||||||
DependencyManager::set<DeferredLightingEffect>();
|
DependencyManager::set<DeferredLightingEffect>();
|
||||||
DependencyManager::set<ResourceCacheSharedItems>();
|
DependencyManager::set<ResourceCacheSharedItems>();
|
||||||
DependencyManager::set<TextureCache>();
|
DependencyManager::set<TextureCache>();
|
||||||
|
|
|
@ -295,7 +295,7 @@ public:
|
||||||
DependencyManager::registerInheritance<LimitedNodeList, NodeList>();
|
DependencyManager::registerInheritance<LimitedNodeList, NodeList>();
|
||||||
//DependencyManager::registerInheritance<SpatialParentFinder, ParentFinder>();
|
//DependencyManager::registerInheritance<SpatialParentFinder, ParentFinder>();
|
||||||
DependencyManager::set<AddressManager>();
|
DependencyManager::set<AddressManager>();
|
||||||
DependencyManager::set<NodeList>(NodeType::Agent, 0);
|
DependencyManager::set<NodeList>(NodeType::Agent);
|
||||||
DependencyManager::set<DeferredLightingEffect>();
|
DependencyManager::set<DeferredLightingEffect>();
|
||||||
DependencyManager::set<ResourceCacheSharedItems>();
|
DependencyManager::set<ResourceCacheSharedItems>();
|
||||||
DependencyManager::set<TextureCache>();
|
DependencyManager::set<TextureCache>();
|
||||||
|
|
Loading…
Reference in a new issue