ListenBrainzScrobbler: Ignore connection closed

This commit is contained in:
Jonas Kvinge
2025-11-23 01:11:59 +01:00
parent f3bc9b151c
commit 2df658e1f3

View File

@@ -346,6 +346,12 @@ void ListenBrainzScrobbler::UpdateNowPlayingRequestFinished(QNetworkReply *reply
QObject::disconnect(reply, nullptr, this, nullptr);
reply->deleteLater();
// ListenBrainz frequently close the connection, ignore any connection closed errors to avoid error popups
if (reply->error() == QNetworkReply::NetworkError::RemoteHostClosedError) {
JsonBaseRequest::Error(QStringLiteral("%1 (%2)").arg(reply->errorString()).arg(reply->error()));
return;
}
const JsonObjectResult json_object_result = ParseJsonObject(reply);
if (!json_object_result.success()) {
Error(json_object_result.error_message);
@@ -451,6 +457,14 @@ void ListenBrainzScrobbler::ScrobbleRequestFinished(QNetworkReply *reply, Scrobb
submitted_ = false;
// ListenBrainz frequently close the connection, ignore any connection closed errors to avoid error popups
if (reply->error() == QNetworkReply::NetworkError::RemoteHostClosedError) {
JsonBaseRequest::Error(QStringLiteral("%1 (%2)").arg(reply->errorString()).arg(reply->error()));
cache_->ClearSent(cache_items);
submit_error_ = true;
return;
}
const JsonObjectResult json_object_result = ParseJsonObject(reply);
if (json_object_result.success()) {
const QJsonObject &json_object = json_object_result.json_object;