Assignment client type is not known at construction

This commit is contained in:
David Rowe 2021-08-18 21:27:35 +12:00
parent 5d15ebb723
commit ace612d038
14 changed files with 21 additions and 26 deletions

View file

@ -70,7 +70,7 @@ AssignmentClientMonitor::AssignmentClientMonitor(const unsigned int numAssignmen
// create a NodeList so we can receive stats from children
DependencyManager::registerInheritance<LimitedNodeList, NodeList>();
auto addressManager = DependencyManager::set<AddressManager>();
auto nodeList = DependencyManager::set<LimitedNodeList>(NodeType::Unassigned, listenPort);
auto nodeList = DependencyManager::set<LimitedNodeList>(listenPort);
auto& packetReceiver = DependencyManager::get<NodeList>()->getPacketReceiver();
packetReceiver.registerListener(PacketType::AssignmentClientStatus,

View file

@ -739,7 +739,7 @@ void DomainServer::setupNodeListAndAssignments() {
// check for scripts the user wants to persist from their domain-server config
populateStaticScriptedAssignmentsFromSettings();
auto nodeList = DependencyManager::set<LimitedNodeList>(NodeType::DomainServer, domainServerPort, domainServerDTLSPort);
auto nodeList = DependencyManager::set<LimitedNodeList>(domainServerPort, domainServerDTLSPort);
// no matter the local port, save it to shared mem so that local assignment clients can ask what it is
nodeList->putLocalPortIntoSharedMemory(DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY, this,

View file

@ -50,8 +50,8 @@ static Setting::Handle<quint16> LIMITED_NODELIST_LOCAL_PORT("LimitedNodeList.Loc
using namespace std::chrono_literals;
static const std::chrono::milliseconds CONNECTION_RATE_INTERVAL_MS = 1s;
LimitedNodeList::LimitedNodeList(char ownerType, int socketListenPort, int dtlsListenPort) :
_nodeSocket(this, true, ownerType),
LimitedNodeList::LimitedNodeList(int socketListenPort, int dtlsListenPort) :
_nodeSocket(this, true),
_packetReceiver(new PacketReceiver(this))
{
qRegisterMetaType<ConnectionStep>("ConnectionStep");

View file

@ -416,8 +416,7 @@ protected:
QUuid connectionSecretUUID;
};
LimitedNodeList(char ownerType = NodeType::DomainServer, int socketListenPort = INVALID_PORT,
int dtlsListenPort = INVALID_PORT);
LimitedNodeList(int socketListenPort = INVALID_PORT, int dtlsListenPort = INVALID_PORT);
LimitedNodeList(LimitedNodeList const&) = delete; // Don't implement, needed to avoid copies of singleton
void operator=(LimitedNodeList const&) = delete; // Don't implement, needed to avoid copies of singleton

View file

@ -50,7 +50,7 @@ const int KEEPALIVE_PING_INTERVAL_MS = 1000;
const int MAX_SYSTEM_INFO_SIZE = 1000;
NodeList::NodeList(char newOwnerType, int socketListenPort, int dtlsListenPort) :
LimitedNodeList(newOwnerType, socketListenPort, dtlsListenPort),
LimitedNodeList(socketListenPort, dtlsListenPort),
_ownerType(newOwnerType),
_nodeTypesOfInterest(),
_domainHandler(this),

View file

@ -154,7 +154,7 @@ private slots:
void maybeSendIgnoreSetToNode(SharedNodePointer node);
private:
NodeList() : LimitedNodeList(NodeType::Unassigned, INVALID_PORT, INVALID_PORT) {
NodeList() : LimitedNodeList(INVALID_PORT, INVALID_PORT) {
assert(false); // Not implemented, needed for DependencyManager templates compile
}
NodeList(char ownerType, int socketListenPort = INVALID_PORT, int dtlsListenPort = INVALID_PORT);

View file

@ -11,13 +11,13 @@
#include "../NetworkLogging.h"
NetworkSocket::NetworkSocket(QObject* parent, NodeType_t nodeType) :
NetworkSocket::NetworkSocket(QObject* parent) :
QObject(parent),
_parent(parent),
_udpSocket(this)
#if defined(WEBRTC_DATA_CHANNELS)
,
_webrtcSocket(this, nodeType)
_webrtcSocket(this)
#endif
{
connect(&_udpSocket, &QUdpSocket::readyRead, this, &NetworkSocket::readyRead);

View file

@ -33,8 +33,7 @@ public:
/// @brief Constructs a new NetworkSocket object.
/// @param parent Qt parent object.
/// @param nodeType The type of node that the NetworkSocket object is being used in.
NetworkSocket(QObject* parent, NodeType_t nodeType);
NetworkSocket(QObject* parent);
/// @brief Set the value of a UDP or WebRTC socket option.

View file

@ -40,9 +40,9 @@ using namespace udt;
#endif
Socket::Socket(QObject* parent, bool shouldChangeSocketOptions, NodeType_t nodeType) :
Socket::Socket(QObject* parent, bool shouldChangeSocketOptions) :
QObject(parent),
_networkSocket(parent, nodeType),
_networkSocket(parent),
_readyReadBackupTimer(new QTimer(this)),
_shouldChangeSocketOptions(shouldChangeSocketOptions)
{

View file

@ -55,8 +55,8 @@ class Socket : public QObject {
public:
using StatsVector = std::vector<std::pair<SockAddr, ConnectionStats::Stats>>;
Socket(QObject* object = 0, bool shouldChangeSocketOptions = true, NodeType_t nodeType = NodeType::Unassigned);
Socket(QObject* object = 0, bool shouldChangeSocketOptions = true);
quint16 localPort(SocketType socketType) const { return _networkSocket.localPort(socketType); }

View file

@ -373,13 +373,12 @@ void WDCConnection::closePeerConnection() {
}
WebRTCDataChannels::WebRTCDataChannels(QObject* parent, NodeType_t nodeType) :
WebRTCDataChannels::WebRTCDataChannels(QObject* parent) :
QObject(parent),
_parent(parent),
_nodeType(nodeType)
_parent(parent)
{
#ifdef WEBRTC_DEBUG
qCDebug(networking_webrtc) << "WebRTCDataChannels::WebRTCDataChannels()" << nodeType << NodeType::getNodeTypeName(nodeType);
qCDebug(networking_webrtc) << "WebRTCDataChannels::WebRTCDataChannels()";
#endif
// Create a peer connection factory.

View file

@ -227,8 +227,7 @@ public:
/// @brief Constructs a new WebRTCDataChannels object.
/// @param parent The parent Qt object.
/// @param nodeType The type of node that the WebRTCDataChannels object is being used in.
WebRTCDataChannels(QObject* parent, NodeType_t nodeType);
WebRTCDataChannels(QObject* parent);
/// @brief Destroys a WebRTCDataChannels object.
~WebRTCDataChannels();

View file

@ -16,9 +16,9 @@
#include "../udt/Constants.h"
WebRTCSocket::WebRTCSocket(QObject* parent, NodeType_t nodeType) :
WebRTCSocket::WebRTCSocket(QObject* parent) :
QObject(parent),
_dataChannels(this, nodeType)
_dataChannels(this)
{
// Route signaling messages.
connect(this, &WebRTCSocket::onSignalingMessage, &_dataChannels, &WebRTCDataChannels::onSignalingMessage);

View file

@ -31,8 +31,7 @@ public:
/// @brief Constructs a new WebRTCSocket object.
/// @param parent Qt parent object.
/// @param nodeType The type of node that the WebRTCsocket object is being used in.
WebRTCSocket(QObject* parent, NodeType_t nodeType);
WebRTCSocket(QObject* parent);
/// @brief Nominally sets the value of a socket option.