Browse Source

Construct QHostAddress more efficiently

adaptive-webui-19844
Chocobo1 5 years ago
parent
commit
2a66bb3127
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 7
      src/base/bittorrent/peerinfo.cpp

7
src/base/bittorrent/peerinfo.cpp

@ -168,8 +168,11 @@ bool PeerInfo::isPlaintextEncrypted() const @@ -168,8 +168,11 @@ bool PeerInfo::isPlaintextEncrypted() const
PeerAddress PeerInfo::address() const
{
return {QHostAddress(QString::fromStdString(m_nativeInfo.ip.address().to_string()))
, m_nativeInfo.ip.port()};
// fast path for platforms which boost.asio internal struct maps to `sockaddr`
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

Loading…
Cancel
Save