Skip to content

Commit

Permalink
do not init servers on startup if they are disabled. default off for …
Browse files Browse the repository at this point in the history
…all servers except UDP
  • Loading branch information
dannagle committed Oct 27, 2024
1 parent dcebe6a commit fb76395
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions src/packetnetwork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,12 @@ void PacketNetwork::init()
tcpPortList = Settings::portsToIntList(settings.value("tcpPort", "0").toString());
sslPortList = Settings::portsToIntList(settings.value("sslPort", "0").toString());

activateDTLS = settings.value("dtlsServerEnable", false).toBool();
activateUDP = settings.value("udpServerEnable", true).toBool();
activateTCP = settings.value("tcpServerEnable", false).toBool();
activateSSL = settings.value("sslServerEnable", false).toBool();


QString ipMode = settings.value("ipMode", "0.0.0.0").toString();
QDEBUGVAR(ipMode);
QMessageBox msgBoxBindError;
Expand All @@ -297,6 +303,7 @@ void PacketNetwork::init()
#ifdef RENDER_ONLY
tcpPortList.clear();
sslPortList.clear();
dtlsPortList.clear();
#endif


Expand All @@ -307,6 +314,10 @@ void PacketNetwork::init()


foreach (dtlsPort, dtlsPortList) {

if(!activateDTLS) {
continue;
}
bool bindResult = dtlsServer.listen(IPV4_OR_IPV6, dtlsPort);


Expand Down Expand Up @@ -340,11 +351,14 @@ void PacketNetwork::init()
}

}
reJoinMulticast();


foreach (udpPort, udpPortList) {

if(!activateUDP) {
continue;
}


udpSocket = new QUdpSocket(this);

Expand Down Expand Up @@ -385,6 +399,11 @@ void PacketNetwork::init()

foreach (tcpPort, tcpPortList) {

if(!activateTCP) {
continue;
}


tcp = new ThreadedTCPServer(this);
tcp->init(tcpPort, false, ipMode);
tcpServers.append(tcp);
Expand All @@ -393,6 +412,10 @@ void PacketNetwork::init()

foreach (sslPort, sslPortList) {

if(!activateSSL) {
continue;
}

ssl = new ThreadedTCPServer(this);
ssl->init(sslPort, true, ipMode);
sslServers.append(ssl);
Expand Down Expand Up @@ -432,10 +455,6 @@ void PacketNetwork::init()

sendResponse = settings.value("sendReponse", false).toBool();
responseData = (settings.value("responseHex", "")).toString();
activateDTLS = settings.value("dtlsServerEnable", true).toBool();
activateUDP = settings.value("udpServerEnable", true).toBool();
activateTCP = settings.value("tcpServerEnable", true).toBool();
activateSSL = settings.value("sslServerEnable", true).toBool();
receiveBeforeSend = settings.value("attemptReceiveCheck", false).toBool();
persistentConnectCheck = settings.value("persistentConnectCheck", false).toBool();
sendSmartResponse = settings.value("smartResponseEnableCheck", false).toBool();
Expand All @@ -452,6 +471,7 @@ void PacketNetwork::init()
#ifdef RENDER_ONLY
activateTCP = false;
activateSSL = false;
activateDTLS = false;
smartList.clear();
#endif
if (settings.value("delayAfterConnectCheck", false).toBool()) {
Expand Down

0 comments on commit fb76395

Please sign in to comment.