Add libtorrent v1.1 basic support

This commit is contained in:
Vladimir Golovnev (Glassez) 2016-01-20 10:15:10 +03:00
parent c93ada1e7b
commit decfae7b8a
8 changed files with 60 additions and 2 deletions

View file

@ -360,7 +360,12 @@ void Session::setSessionSettings()
sessionSettings.active_lsd_limit = -1;
// Outgoing ports
#if LIBTORRENT_VERSION_NUM < 10100
sessionSettings.outgoing_ports = std::make_pair(pref->outgoingPortsMin(), pref->outgoingPortsMax());
#else
sessionSettings.outgoing_port = pref->outgoingPortsMin();
sessionSettings.num_outgoing_ports = pref->outgoingPortsMax() - pref->outgoingPortsMin();
#endif
// Ignore limits on LAN
qDebug() << "Ignore limits on LAN" << pref->getIgnoreLimitsOnLAN();
sessionSettings.ignore_limits_on_local_network = pref->getIgnoreLimitsOnLAN();
@ -2261,7 +2266,6 @@ void Session::handleListenSucceededAlert(libt::listen_succeeded_alert *p)
void Session::handleListenFailedAlert(libt::listen_failed_alert *p)
{
boost::system::error_code ec;
QString proto = "TCP";
if (p->sock_type == libt::listen_failed_alert::udp)
proto = "UDP";
@ -2273,12 +2277,24 @@ void Session::handleListenFailedAlert(libt::listen_failed_alert *p)
proto = "I2P";
else if (p->sock_type == libt::listen_failed_alert::socks5)
proto = "SOCKS5";
#if LIBTORRENT_VERSION_NUM < 10100
boost::system::error_code ec;
qDebug() << "Failed listening on " << proto << p->endpoint.address().to_string(ec).c_str() << "/" << p->endpoint.port();
Logger::instance()->addMessage(
tr("qBittorrent failed listening on interface %1 port: %2/%3. Reason: %4.",
"e.g: qBittorrent failed listening on interface 192.168.0.1 port: TCP/6881. Reason: already in use.")
.arg(p->endpoint.address().to_string(ec).c_str()).arg(proto).arg(QString::number(p->endpoint.port()))
.arg(QString::fromLocal8Bit(p->error.message().c_str())), Log::CRITICAL);
#else
qDebug() << "Failed listening on " << proto << p->listen_interface();
Logger::instance()->addMessage(
tr("qBittorrent failed listening on interface %1 [%2]. Reason: %3.",
"e.g: qBittorrent failed listening on interface 192.168.0.1 [TCP]. Reason: already in use.")
.arg(QString::fromUtf8(p->listen_interface()))
.arg(proto)
.arg(Utils::String::fromStdString(p->error.message())), Log::CRITICAL);
#endif
}
void Session::handleExternalIPAlert(libt::external_ip_alert *p)