fix division by zero
This commit is contained in:
parent
21b51afd5f
commit
46683f59f8
|
@ -606,6 +606,8 @@ namespace libtorrent
|
|||
{
|
||||
TORRENT_ASSERT(!m_dirty);
|
||||
TORRENT_ASSERT(priority >= 0);
|
||||
TORRENT_ASSERT(elem_index < int(m_pieces.size()));
|
||||
TORRENT_ASSERT(elem_index >= 0);
|
||||
|
||||
#ifdef TORRENT_PICKER_LOG
|
||||
std::cerr << "remove " << m_pieces[elem_index] << " (" << priority << ")" << std::endl;
|
||||
|
|
|
@ -3893,9 +3893,9 @@ namespace aux {
|
|||
STAT_LOG(d, m_connect_timeouts);
|
||||
STAT_LOG(d, m_uninteresting_peers);
|
||||
STAT_LOG(d, m_timeout_peers);
|
||||
STAT_LOG(f, (float(m_total_failed_bytes) * 100.f / m_stat.total_payload_download()));
|
||||
STAT_LOG(f, (float(m_total_redundant_bytes) * 100.f / m_stat.total_payload_download()));
|
||||
STAT_LOG(f, (float(m_stat.total_protocol_download()) * 100.f / m_stat.total_download()));
|
||||
STAT_LOG(f, (float(m_total_failed_bytes) * 100.f / (m_stat.total_payload_download() == 0 ? 1 : m_stat.total_payload_download())));
|
||||
STAT_LOG(f, (float(m_total_redundant_bytes) * 100.f / (m_stat.total_payload_download() == 0 ? 1 : m_stat.total_payload_download())));
|
||||
STAT_LOG(f, (float(m_stat.total_protocol_download()) * 100.f / (m_stat.total_download() == 0 ? 1 : m_stat.total_download())));
|
||||
STAT_LOG(f, float(cs.average_read_time) / 1000000.f);
|
||||
STAT_LOG(f, float(cs.average_write_time) / 1000000.f);
|
||||
STAT_LOG(f, float(cs.average_queue_time) / 1000000.f);
|
||||
|
@ -3979,7 +3979,7 @@ namespace aux {
|
|||
/ double(tick_interval_ms * 10));
|
||||
|
||||
for (int i = 0; i < torrent::waste_reason_max; ++i)
|
||||
STAT_LOG(f, (m_redundant_bytes[i] * 100.) / double(m_total_redundant_bytes));
|
||||
STAT_LOG(f, (m_redundant_bytes[i] * 100.) / double(m_total_redundant_bytes == 0 ? 1 : m_total_redundant_bytes));
|
||||
|
||||
STAT_LOG(d, m_no_memory_peers);
|
||||
STAT_LOG(d, m_too_many_peers);
|
||||
|
|
Loading…
Reference in New Issue