Browse Source

Improve compatibility with libtorrent 2.0

In libtorrent 2.0, the `connection_type` was changed to a flag type and
hence it cannot be used in a switch statement directly. Also our use of
`connection_type` is limited so that a single equality comparison
would cover all of our use cases.
adaptive-webui-19844
Chocobo1 4 years ago
parent
commit
c95e450b8d
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 14
      src/base/bittorrent/peerinfo.cpp

14
src/base/bittorrent/peerinfo.cpp

@ -220,17 +220,9 @@ QString PeerInfo::connectionType() const
if (m_nativeInfo.flags & lt::peer_info::utp_socket) if (m_nativeInfo.flags & lt::peer_info::utp_socket)
return QString::fromUtf8(C_UTP); return QString::fromUtf8(C_UTP);
QString connection; return (m_nativeInfo.connection_type == lt::peer_info::standard_bittorrent)
switch (m_nativeInfo.connection_type) { ? QLatin1String {"BT"}
case lt::peer_info::http_seed: : QLatin1String {"Web"};
case lt::peer_info::web_seed:
connection = "Web";
break;
default:
connection = "BT";
}
return connection;
} }
void PeerInfo::calcRelevance(const TorrentHandle *torrent) void PeerInfo::calcRelevance(const TorrentHandle *torrent)

Loading…
Cancel
Save