1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-22 20:44:15 +00:00

Improve SOCKS5 error messages

This commit is contained in:
Vladimir Golovnev (Glassez) 2023-02-13 17:26:41 +03:00
parent 96da685e5d
commit cbf591a8b5
No known key found for this signature in database
GPG Key ID: 52A2C7DEE2DFA6F7

View File

@ -42,7 +42,10 @@
#include <iphlpapi.h>
#endif
#include <boost/asio/ip/tcp.hpp>
#include <libtorrent/add_torrent_params.hpp>
#include <libtorrent/address.hpp>
#include <libtorrent/alert_types.hpp>
#include <libtorrent/error_code.hpp>
#include <libtorrent/extensions/smart_ban.hpp>
@ -5779,8 +5782,12 @@ void SessionImpl::handleSocks5Alert(const lt::socks5_alert *p) const
{
if (p->error)
{
LogMsg(tr("SOCKS5 proxy error. Message: \"%1\"").arg(QString::fromStdString(p->message()))
, Log::WARNING);
const auto addr = p->ip.address();
const QString endpoint = (addr.is_v6() ? u"[%1]:%2"_qs : u"%1:%2"_qs)
.arg(QString::fromStdString(addr.to_string()), QString::number(p->ip.port()));
LogMsg(tr("SOCKS5 proxy error. Address: %1. Message: \"%2\".")
.arg(endpoint, QString::fromLocal8Bit(p->error.message().c_str()))
, Log::WARNING);
}
}