aboutsummaryrefslogtreecommitdiff
path: root/src/protocolhandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/protocolhandler.cpp')
-rw-r--r--src/protocolhandler.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/protocolhandler.cpp b/src/protocolhandler.cpp
index 5a87bac..6a3bd92 100644
--- a/src/protocolhandler.cpp
+++ b/src/protocolhandler.cpp
@@ -2,7 +2,6 @@
ProtocolHandler::ProtocolHandler(QObject *parent) : QObject(parent)
{
-
}
bool ProtocolHandler::enableClientCertificate(const CryptoIdentity &ident)
@@ -13,5 +12,34 @@ bool ProtocolHandler::enableClientCertificate(const CryptoIdentity &ident)
void ProtocolHandler::disableClientCertificate()
{
+}
+void ProtocolHandler::emitNetworkError(QAbstractSocket::SocketError error_code, const QString &textual_description)
+{
+ NetworkError network_error = UnknownError;
+ switch (error_code)
+ {
+ case QAbstractSocket::ConnectionRefusedError:
+ network_error = ConnectionRefused;
+ break;
+ case QAbstractSocket::HostNotFoundError:
+ network_error = HostNotFound;
+ break;
+ case QAbstractSocket::SocketTimeoutError:
+ network_error = Timeout;
+ break;
+ case QAbstractSocket::SslHandshakeFailedError:
+ network_error = TlsFailure;
+ break;
+ case QAbstractSocket::SslInternalError:
+ network_error = TlsFailure;
+ break;
+ case QAbstractSocket::SslInvalidUserDataError:
+ network_error = TlsFailure;
+ break;
+ default:
+ qDebug() << "unhandled network error:" << error_code;
+ break;
+ }
+ emit this->networkError(network_error, textual_description);
}