mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-23 21:05:44 +03:00
prevent infinte recursion when closing a websocket in case of SSL errors
the slots connected to the web socket can be called even during close and lead to infinite calls to close -> error slot -> close -> ... Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
This commit is contained in:
parent
46f7d07889
commit
95e3ecfd3c
1 changed files with 5 additions and 0 deletions
|
@ -76,6 +76,9 @@ void PushNotifications::closeWebSocket()
|
||||||
_reconnectTimer->stop();
|
_reconnectTimer->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
disconnect(_webSocket, QOverload<QAbstractSocket::SocketError>::of(&QWebSocket::error), this, &PushNotifications::onWebSocketError);
|
||||||
|
disconnect(_webSocket, &QWebSocket::sslErrors, this, &PushNotifications::onWebSocketSslErrors);
|
||||||
|
|
||||||
_webSocket->close();
|
_webSocket->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,6 +174,8 @@ void PushNotifications::openWebSocket()
|
||||||
const auto webSocketUrl = capabilities.pushNotificationsWebSocketUrl();
|
const auto webSocketUrl = capabilities.pushNotificationsWebSocketUrl();
|
||||||
|
|
||||||
qCInfo(lcPushNotifications) << "Open connection to websocket on" << webSocketUrl << "for account" << _account->url();
|
qCInfo(lcPushNotifications) << "Open connection to websocket on" << webSocketUrl << "for account" << _account->url();
|
||||||
|
connect(_webSocket, QOverload<QAbstractSocket::SocketError>::of(&QWebSocket::error), this, &PushNotifications::onWebSocketError);
|
||||||
|
connect(_webSocket, &QWebSocket::sslErrors, this, &PushNotifications::onWebSocketSslErrors);
|
||||||
_webSocket->open(webSocketUrl);
|
_webSocket->open(webSocketUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue