mirror of
https://github.com/QuasarApp/Heart.git
synced 2025-05-11 17:09:41 +00:00
added ssl error hndler
This commit is contained in:
parent
3627ed8076
commit
294b91b933
@ -470,7 +470,7 @@ bool AbstractNode::configureSslSocket(AbstractNodeInfo *node, bool fServer) {
|
||||
});
|
||||
|
||||
connect(socket, &SslSocket::sslErrorsOcurred,
|
||||
this, &AbstractNode::handleSslErrorOcurred, Qt::DirectConnection);
|
||||
this, &AbstractNode::handleSslErrorOcurredPrivate, Qt::DirectConnection);
|
||||
|
||||
|
||||
AsyncLauncher::Job action = [socket, fServer]() -> bool {
|
||||
@ -536,13 +536,13 @@ void AbstractNode::handleEncrypted(AbstractNodeInfo *node) {
|
||||
handleNodeStatusChanged(node, NodeCoonectionStatus::Connected);
|
||||
}
|
||||
|
||||
void AbstractNode::handleSslErrorOcurred(SslSocket * sslScocket, const QList<QSslError> &errors) {
|
||||
void AbstractNode::handleSslErrorOcurredPrivate(SslSocket * sslScocket, const QList<QSslError> &errors) {
|
||||
|
||||
QList<QSslError> ignore;
|
||||
for (auto &error : errors) {
|
||||
|
||||
if (!_ignoreSslErrors.contains(QSslError{error.error()})) {
|
||||
QuasarAppUtils::Params::log(error.errorString(), QuasarAppUtils::Error);
|
||||
handleSslErrorOcurred(sslScocket, error);
|
||||
} else {
|
||||
ignore += error;
|
||||
}
|
||||
@ -556,6 +556,13 @@ void AbstractNode::handleSslErrorOcurred(SslSocket * sslScocket, const QList<QSs
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void AbstractNode::handleSslErrorOcurred(SslSocket *scket,
|
||||
const QSslError &error) {
|
||||
QuasarAppUtils::Params::log(scket->peerAddress().toString() + " : " + error.errorString(),
|
||||
QuasarAppUtils::Error);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
AbstractNodeInfo *AbstractNode::createNodeInfo(QAbstractSocket *socket,
|
||||
|
@ -645,6 +645,17 @@ protected slots:
|
||||
QAbstractSocket::SocketError errorCode,
|
||||
QString errorString);
|
||||
|
||||
#ifdef USE_HEART_SSL
|
||||
|
||||
/**
|
||||
* @brief handleSslErrorOcurred This method invoked when a ssl socket receive an error mesage.
|
||||
* Default implementation just pront error messages
|
||||
* Overrid this method for handle ssl errors on this node or server.
|
||||
* @param error This is error that occured..
|
||||
*/
|
||||
virtual void handleSslErrorOcurred(SslSocket *scket, const QSslError& error);
|
||||
#endif
|
||||
|
||||
private slots:
|
||||
|
||||
void avelableBytes(AbstractNodeInfo* sender);
|
||||
@ -677,11 +688,11 @@ private slots:
|
||||
#ifdef USE_HEART_SSL
|
||||
|
||||
/**
|
||||
* @brief handleSslErrorOcurred This method invoked when a ssl socket receive an error mesage.
|
||||
* @brief handleSslErrorOcurredPrivate This method invoked when a ssl socket receive an error mesage.
|
||||
* Default implementation just pront error messages
|
||||
* @param errors This is errors list.
|
||||
*/
|
||||
void handleSslErrorOcurred(SslSocket *sender, const QList<QSslError> & errors);
|
||||
void handleSslErrorOcurredPrivate(SslSocket *sender, const QList<QSslError> & errors);
|
||||
|
||||
/**
|
||||
* @brief handleEncrypted invoke when a ssl socket is encripted!
|
||||
|
Loading…
x
Reference in New Issue
Block a user