From cbf591a8b5d4c5b328e4df548e6b56d846270d95 Mon Sep 17 00:00:00 2001 From: "Vladimir Golovnev (Glassez)" Date: Mon, 13 Feb 2023 17:26:41 +0300 Subject: [PATCH] Improve SOCKS5 error messages --- src/base/bittorrent/sessionimpl.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/base/bittorrent/sessionimpl.cpp b/src/base/bittorrent/sessionimpl.cpp index c862a6197..a7f950453 100644 --- a/src/base/bittorrent/sessionimpl.cpp +++ b/src/base/bittorrent/sessionimpl.cpp @@ -42,7 +42,10 @@ #include #endif +#include + #include +#include #include #include #include @@ -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); } }