Browse Source

Merge pull request #11157 from Chocobo1/hostaddr

Construct QHostAddress more efficiently
adaptive-webui-19844
Mike Tzou 5 years ago committed by GitHub
parent
commit
1bb06a7428
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      src/base/bittorrent/peerinfo.cpp

7
src/base/bittorrent/peerinfo.cpp

@ -168,8 +168,11 @@ bool PeerInfo::isPlaintextEncrypted() const
PeerAddress PeerInfo::address() const PeerAddress PeerInfo::address() const
{ {
return {QHostAddress(QString::fromStdString(m_nativeInfo.ip.address().to_string())) // fast path for platforms which boost.asio internal struct maps to `sockaddr`
, m_nativeInfo.ip.port()}; return {QHostAddress(m_nativeInfo.ip.data()), m_nativeInfo.ip.port()};
// slow path for the others
//return {QHostAddress(QString::fromStdString(m_nativeInfo.ip.address().to_string()))
// , m_nativeInfo.ip.port()};
} }
QString PeerInfo::client() const QString PeerInfo::client() const

Loading…
Cancel
Save