diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index 51b0b478e..3c0e49df9 100644 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -4606,7 +4606,7 @@ namespace libtorrent #endif return m_ses.m_upload_rate.request_bandwidth(self() , (std::max)(m_send_buffer.size(), m_statistics.upload_rate() * 2 - / (1000 / m_ses.m_settings.tick_interval)) + * m_ses.m_settings.tick_interval / 1000) , priority , bwc1, bwc2, bwc3, bwc4); } @@ -4638,8 +4638,7 @@ namespace libtorrent TORRENT_ASSERT((m_channel_state[download_channel] & peer_info::bw_limit) == 0); return m_ses.m_download_rate.request_bandwidth(self() , (std::max)((std::max)(m_outstanding_bytes, m_packet_size - m_recv_pos) + 30 - , m_statistics.download_rate() * 2 - / (1000 / m_ses.m_settings.tick_interval)) + , m_statistics.download_rate() * 2 * m_ses.m_settings.tick_interval / 1000) , priority , bwc1, bwc2, bwc3, bwc4); } diff --git a/src/utp_stream.cpp b/src/utp_stream.cpp index 88ec993fd..48abcc4d2 100644 --- a/src/utp_stream.cpp +++ b/src/utp_stream.cpp @@ -1682,6 +1682,8 @@ bool utp_socket_impl::send_pkt(int flags) stack_alloced = true; #endif TORRENT_ASSERT(force); + // TODO: 3 this alloca() statement won't necessariky produce + // correctly aligned memory. do something about that p = (packet*)TORRENT_ALLOCA(char, sizeof(packet) + packet_size); UTP_LOGV("%8p: allocating %d bytes on the stack\n", this, packet_size); p->allocated = packet_size;