void Server::incomingConnection(qintptr socketDescriptor)
{
QSslSocket *serverSocket = new QSslSocket(parent());
if (serverSocket->setSocketDescriptor(socketDescriptor)) {
QObject::connect(this, &Server::closed, serverSocket, &QSslSocket::abort);
addPendingConnection(serverSocket);
} else {
qWarning() << "setSocketDescriptor failed" << serverSocket->errorString();
delete serverSocket;
}
}
This adds a socket descriptor to the list of sockets that the server wants to accept. It sets the socket descriptor on the server socket and sets the signal pendingConnection to false.