summaryrefslogtreecommitdiffstats
path: root/examples/remoteobjects/ssl/sslserver/sslserver.cpp
diff options
context:
space:
mode:
authorØystein Heskestad <oystein.heskestad@qt.io>2023-05-22 16:41:35 +0200
committerØystein Heskestad <oystein.heskestad@qt.io>2023-06-06 07:35:51 +0000
commit743de69538696ea14e299c32056d40851bb9fdcd (patch)
treebbe4b9197043614d8d13700afa383257ed75f081 /examples/remoteobjects/ssl/sslserver/sslserver.cpp
parent98522adc399e4fcd97808a0ae4c3a231d6c67739 (diff)
Revamp SSL example
The example did not work because the two applications used different rep-files to generate the remote objects. Use the same file in both applications, fix usage of case in naming, expand the documentation, and add a picture. Remove unused PresetData from rep-file. Task-number: QTBUG-112850 Pick-to: 6.5 6.6 Change-Id: Ia7aafc52d647bca9ffec12b8dd548377f20b6ce4 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'examples/remoteobjects/ssl/sslserver/sslserver.cpp')
-rw-r--r--examples/remoteobjects/ssl/sslserver/sslserver.cpp32
1 files changed, 0 insertions, 32 deletions
diff --git a/examples/remoteobjects/ssl/sslserver/sslserver.cpp b/examples/remoteobjects/ssl/sslserver/sslserver.cpp
deleted file mode 100644
index 98c0402..0000000
--- a/examples/remoteobjects/ssl/sslserver/sslserver.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright (C) 2018 Ford Motor Company
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#include "sslserver.h"
-#include <QSslSocket>
-
-SslServer::SslServer(QObject *parent)
- : QTcpServer(parent)
-{}
-
-
-void SslServer::incomingConnection(qintptr socketDescriptor)
-{
- auto serverSocket = new QSslSocket;
- if (serverSocket->setSocketDescriptor(socketDescriptor)) {
- addPendingConnection(serverSocket);
- connect(serverSocket, &QSslSocket::encrypted, this, [this, serverSocket] {
- Q_EMIT encryptedSocketReady(serverSocket);
- });
- connect(serverSocket, static_cast<void (QSslSocket::*)(const QList<QSslError>&)>(&QSslSocket::sslErrors),
- this, [serverSocket](const QList<QSslError>& errors){
- qWarning() << "Error:" << serverSocket << errors;
- delete serverSocket;
- });
- serverSocket->setPeerVerifyMode(QSslSocket::VerifyPeer);
- serverSocket->setLocalCertificate(QStringLiteral(":/sslcert/server.crt"));
- serverSocket->setPrivateKey(QStringLiteral(":/sslcert/server.key"));
- serverSocket->startServerEncryption();
- } else {
- delete serverSocket;
- }
-}