Browse Source

Use C++20 designated initializers

adaptive-webui-19844
Chocobo1 3 years ago
parent
commit
c58aa58cba
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 69
      src/base/bittorrent/sessionimpl.cpp

69
src/base/bittorrent/sessionimpl.cpp

@ -1571,37 +1571,48 @@ void SessionImpl::initMetrics()
return index; return index;
}; };
// TODO: switch to "designated initializers" in C++20 m_metricIndices =
m_metricIndices.net.hasIncomingConnections = findMetricIndex("net.has_incoming_connections"); {
m_metricIndices.net.sentPayloadBytes = findMetricIndex("net.sent_payload_bytes"); .net =
m_metricIndices.net.recvPayloadBytes = findMetricIndex("net.recv_payload_bytes"); {
m_metricIndices.net.sentBytes = findMetricIndex("net.sent_bytes"); .hasIncomingConnections = findMetricIndex("net.has_incoming_connections"),
m_metricIndices.net.recvBytes = findMetricIndex("net.recv_bytes"); .sentPayloadBytes = findMetricIndex("net.sent_payload_bytes"),
m_metricIndices.net.sentIPOverheadBytes = findMetricIndex("net.sent_ip_overhead_bytes"); .recvPayloadBytes = findMetricIndex("net.recv_payload_bytes"),
m_metricIndices.net.recvIPOverheadBytes = findMetricIndex("net.recv_ip_overhead_bytes"); .sentBytes = findMetricIndex("net.sent_bytes"),
m_metricIndices.net.sentTrackerBytes = findMetricIndex("net.sent_tracker_bytes"); .recvBytes = findMetricIndex("net.recv_bytes"),
m_metricIndices.net.recvTrackerBytes = findMetricIndex("net.recv_tracker_bytes"); .sentIPOverheadBytes = findMetricIndex("net.sent_ip_overhead_bytes"),
m_metricIndices.net.recvRedundantBytes = findMetricIndex("net.recv_redundant_bytes"); .recvIPOverheadBytes = findMetricIndex("net.recv_ip_overhead_bytes"),
m_metricIndices.net.recvFailedBytes = findMetricIndex("net.recv_failed_bytes"); .sentTrackerBytes = findMetricIndex("net.sent_tracker_bytes"),
.recvTrackerBytes = findMetricIndex("net.recv_tracker_bytes"),
m_metricIndices.peer.numPeersConnected = findMetricIndex("peer.num_peers_connected"); .recvRedundantBytes = findMetricIndex("net.recv_redundant_bytes"),
m_metricIndices.peer.numPeersDownDisk = findMetricIndex("peer.num_peers_down_disk"); .recvFailedBytes = findMetricIndex("net.recv_failed_bytes")
m_metricIndices.peer.numPeersUpDisk = findMetricIndex("peer.num_peers_up_disk"); },
.peer =
m_metricIndices.dht.dhtBytesIn = findMetricIndex("dht.dht_bytes_in"); {
m_metricIndices.dht.dhtBytesOut = findMetricIndex("dht.dht_bytes_out"); .numPeersConnected = findMetricIndex("peer.num_peers_connected"),
m_metricIndices.dht.dhtNodes = findMetricIndex("dht.dht_nodes"); .numPeersUpDisk = findMetricIndex("peer.num_peers_up_disk"),
.numPeersDownDisk = findMetricIndex("peer.num_peers_down_disk")
m_metricIndices.disk.diskBlocksInUse = findMetricIndex("disk.disk_blocks_in_use"); },
m_metricIndices.disk.numBlocksRead = findMetricIndex("disk.num_blocks_read"); .dht =
{
.dhtBytesIn = findMetricIndex("dht.dht_bytes_in"),
.dhtBytesOut = findMetricIndex("dht.dht_bytes_out"),
.dhtNodes = findMetricIndex("dht.dht_nodes")
},
.disk =
{
.diskBlocksInUse = findMetricIndex("disk.disk_blocks_in_use"),
.numBlocksRead = findMetricIndex("disk.num_blocks_read"),
#ifndef QBT_USES_LIBTORRENT2 #ifndef QBT_USES_LIBTORRENT2
m_metricIndices.disk.numBlocksCacheHits = findMetricIndex("disk.num_blocks_cache_hits"); .numBlocksCacheHits = findMetricIndex("disk.num_blocks_cache_hits"),
#endif #endif
m_metricIndices.disk.writeJobs = findMetricIndex("disk.num_write_ops"); .writeJobs = findMetricIndex("disk.num_write_ops"),
m_metricIndices.disk.readJobs = findMetricIndex("disk.num_read_ops"); .readJobs = findMetricIndex("disk.num_read_ops"),
m_metricIndices.disk.hashJobs = findMetricIndex("disk.num_blocks_hashed"); .hashJobs = findMetricIndex("disk.num_blocks_hashed"),
m_metricIndices.disk.queuedDiskJobs = findMetricIndex("disk.queued_disk_jobs"); .queuedDiskJobs = findMetricIndex("disk.queued_disk_jobs"),
m_metricIndices.disk.diskJobTime = findMetricIndex("disk.disk_job_time"); .diskJobTime = findMetricIndex("disk.disk_job_time")
}
};
} }
lt::settings_pack SessionImpl::loadLTSettings() const lt::settings_pack SessionImpl::loadLTSettings() const

Loading…
Cancel
Save