Browse Source

Improve SOCKS5 error messages

adaptive-webui-19844
Vladimir Golovnev (Glassez) 2 years ago
parent
commit
cbf591a8b5
No known key found for this signature in database
GPG Key ID: 52A2C7DEE2DFA6F7
  1. 11
      src/base/bittorrent/sessionimpl.cpp

11
src/base/bittorrent/sessionimpl.cpp

@ -42,7 +42,10 @@
#include <iphlpapi.h> #include <iphlpapi.h>
#endif #endif
#include <boost/asio/ip/tcp.hpp>
#include <libtorrent/add_torrent_params.hpp> #include <libtorrent/add_torrent_params.hpp>
#include <libtorrent/address.hpp>
#include <libtorrent/alert_types.hpp> #include <libtorrent/alert_types.hpp>
#include <libtorrent/error_code.hpp> #include <libtorrent/error_code.hpp>
#include <libtorrent/extensions/smart_ban.hpp> #include <libtorrent/extensions/smart_ban.hpp>
@ -5779,8 +5782,12 @@ void SessionImpl::handleSocks5Alert(const lt::socks5_alert *p) const
{ {
if (p->error) if (p->error)
{ {
LogMsg(tr("SOCKS5 proxy error. Message: \"%1\"").arg(QString::fromStdString(p->message())) const auto addr = p->ip.address();
, Log::WARNING); 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);
} }
} }

Loading…
Cancel
Save