mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-08 18:02:13 +02:00
move DTLS socket changes to LimitedNodeList
This commit is contained in:
parent
55d540a0eb
commit
a25ef58247
2 changed files with 14 additions and 12 deletions
|
@ -66,18 +66,6 @@ DomainServer::DomainServer(int argc, char* argv[]) :
|
|||
|
||||
LimitedNodeList* nodeList = LimitedNodeList::getInstance();
|
||||
|
||||
#if defined(IP_DONTFRAG) || defined(IP_MTU_DISCOVER)
|
||||
qDebug() << "Making required DTLS changes to NodeList DTLS socket.";
|
||||
|
||||
int socketHandle = LimitedNodeList::getInstance()->getDTLSSocket().socketDescriptor();
|
||||
#if defined(IP_DONTFRAG)
|
||||
int optValue = 1;
|
||||
setsockopt(socketHandle, IPPROTO_IP, IP_DONTFRAG, (const void*) optValue, sizeof(optValue));
|
||||
#elif defined(IP_MTU_DISCOVER)
|
||||
int optValue = 1;
|
||||
setsockopt(socketHandle, IPPROTO_IP, IP_MTU_DISCOVER, (const void*) optValue, sizeof(optValue));
|
||||
#endif
|
||||
#endif
|
||||
// connect our socket to read datagrams received on the DTLS socket
|
||||
connect(&nodeList->getDTLSSocket(), &QUdpSocket::readyRead, this, &DomainServer::readAvailableDTLSDatagrams);
|
||||
}
|
||||
|
|
|
@ -105,6 +105,20 @@ QUdpSocket& LimitedNodeList::getDTLSSocket() {
|
|||
_dtlsSocket = new QUdpSocket(this);
|
||||
|
||||
_dtlsSocket->bind(QHostAddress::AnyIPv4, 0, QAbstractSocket::DontShareAddress);
|
||||
|
||||
#if defined(IP_DONTFRAG) || defined(IP_MTU_DISCOVER)
|
||||
qDebug() << "Making required DTLS changes to LimitedNodeList DTLS socket.";
|
||||
|
||||
int socketHandle = _dtlsSocket->socketDescriptor();
|
||||
#if defined(IP_DONTFRAG)
|
||||
int optValue = 1;
|
||||
setsockopt(socketHandle, IPPROTO_IP, IP_DONTFRAG, (const void*) optValue, sizeof(optValue));
|
||||
#elif defined(IP_MTU_DISCOVER)
|
||||
int optValue = 1;
|
||||
setsockopt(socketHandle, IPPROTO_IP, IP_MTU_DISCOVER, (const void*) optValue, sizeof(optValue));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
qDebug() << "NodeList DTLS socket is listening on" << _dtlsSocket->localPort();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue