summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorKurt Pattyn <pattyn.kurt@gmail.com>2014-02-16 14:01:28 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-16 14:44:35 +0100
commitdd1a86e93af2c95b7018fa757d9248a6c5a11cfa (patch)
tree4b7c35b6a10d4de36cfabbc19db6398db0a69e11 /examples
parent4a066d55a311013dbdc5844624ba3ca8d08f84e1 (diff)
downloadqtwebsockets-dd1a86e93af2c95b7018fa757d9248a6c5a11cfa.tar.gz
Catch SSL errors in example
Change-Id: Ib9a399789878030361d9bdddd8dbfbb1832cf756 Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/sslechoserver/sslechoserver.cpp7
-rw-r--r--examples/sslechoserver/sslechoserver.h2
2 files changed, 9 insertions, 0 deletions
diff --git a/examples/sslechoserver/sslechoserver.cpp b/examples/sslechoserver/sslechoserver.cpp
index 53f5066..9b35f15 100644
--- a/examples/sslechoserver/sslechoserver.cpp
+++ b/examples/sslechoserver/sslechoserver.cpp
@@ -78,6 +78,8 @@ SslEchoServer::SslEchoServer(quint16 port, QObject *parent) :
qDebug() << "SSL Echo Server listening on port" << port;
connect(m_pWebSocketServer, &QWebSocketServer::newConnection,
this, &SslEchoServer::onNewConnection);
+ connect(m_pWebSocketServer, &QWebSocketServer::sslErrors,
+ this, &SslEchoServer::onSslErrors);
}
}
//! [constructor]
@@ -138,4 +140,9 @@ void SslEchoServer::socketDisconnected()
pClient->deleteLater();
}
}
+
+void SslEchoServer::onSslErrors(const QList<QSslError> &)
+{
+ qDebug() << "Ssl errors occurred";
+}
//! [socketDisconnected]
diff --git a/examples/sslechoserver/sslechoserver.h b/examples/sslechoserver/sslechoserver.h
index b2ac3f7..84dfeab 100644
--- a/examples/sslechoserver/sslechoserver.h
+++ b/examples/sslechoserver/sslechoserver.h
@@ -44,6 +44,7 @@
#include <QtCore/QObject>
#include <QtCore/QList>
#include <QtCore/QByteArray>
+#include <QtNetwork/QSslError>
QT_FORWARD_DECLARE_CLASS(QWebSocketServer)
QT_FORWARD_DECLARE_CLASS(QWebSocket)
@@ -62,6 +63,7 @@ private Q_SLOTS:
void processTextMessage(QString message);
void processBinaryMessage(QByteArray message);
void socketDisconnected();
+ void onSslErrors(const QList<QSslError> &errors);
private:
QWebSocketServer *m_pWebSocketServer;