Add logging for some alerts

Specifically these alerts:
* i2p_alert
* session_error_alert

PR #19662.
This commit is contained in:
Chocobo1 2023-09-30 11:43:44 +08:00 committed by Vladimir Golovnev
parent a84259dd1a
commit e6cde0b4b4
2 changed files with 39 additions and 16 deletions

View file

@ -5557,6 +5557,9 @@ void SessionImpl::handleAlert(const lt::alert *a)
case lt::state_update_alert::alert_type:
handleStateUpdateAlert(static_cast<const lt::state_update_alert *>(a));
break;
case lt::session_error_alert::alert_type:
handleSessionErrorAlert(static_cast<const lt::session_error_alert *>(a));
break;
case lt::session_stats_alert::alert_type:
handleSessionStatsAlert(static_cast<const lt::session_stats_alert *>(a));
break;
@ -5617,6 +5620,9 @@ void SessionImpl::handleAlert(const lt::alert *a)
case lt::socks5_alert::alert_type:
handleSocks5Alert(static_cast<const lt::socks5_alert *>(a));
break;
case lt::i2p_alert::alert_type:
handleI2PAlert(static_cast<const lt::i2p_alert *>(a));
break;
#ifdef QBT_USES_LIBTORRENT2
case lt::torrent_conflict_alert::alert_type:
handleTorrentConflictAlert(static_cast<const lt::torrent_conflict_alert *>(a));
@ -5923,6 +5929,12 @@ void SessionImpl::handleExternalIPAlert(const lt::external_ip_alert *p)
}
}
void SessionImpl::handleSessionErrorAlert(const lt::session_error_alert *p) const
{
LogMsg(tr("BitTorrent session encountered a serious error. Reason: \"%1\"")
.arg(QString::fromStdString(p->message())), Log::CRITICAL);
}
void SessionImpl::handleSessionStatsAlert(const lt::session_stats_alert *p)
{
if (m_refreshEnqueued)
@ -6117,6 +6129,15 @@ void SessionImpl::handleSocks5Alert(const lt::socks5_alert *p) const
}
}
void SessionImpl::handleI2PAlert(const lt::i2p_alert *p) const
{
if (p->error)
{
LogMsg(tr("I2P error. Message: \"%1\".")
.arg(QString::fromStdString(p->message())), Log::WARNING);
}
}
void SessionImpl::handleTrackerAlert(const lt::tracker_alert *a)
{
TorrentImpl *torrent = m_torrents.value(a->handle.info_hash());

View file

@ -564,11 +564,13 @@ namespace BitTorrent
void handleListenSucceededAlert(const lt::listen_succeeded_alert *p);
void handleListenFailedAlert(const lt::listen_failed_alert *p);
void handleExternalIPAlert(const lt::external_ip_alert *p);
void handleSessionErrorAlert(const lt::session_error_alert *p) const;
void handleSessionStatsAlert(const lt::session_stats_alert *p);
void handleAlertsDroppedAlert(const lt::alerts_dropped_alert *p) const;
void handleStorageMovedAlert(const lt::storage_moved_alert *p);
void handleStorageMovedFailedAlert(const lt::storage_moved_failed_alert *p);
void handleSocks5Alert(const lt::socks5_alert *p) const;
void handleI2PAlert(const lt::i2p_alert *p) const;
void handleTrackerAlert(const lt::tracker_alert *a);
#ifdef QBT_USES_LIBTORRENT2
void handleTorrentConflictAlert(const lt::torrent_conflict_alert *a);