minor code refactor in utp related code, more use of const
This commit is contained in:
parent
95b753778d
commit
a2ea79de4e
|
@ -211,8 +211,8 @@ namespace libtorrent {
|
|||
else if (allocate <= m_mtu_ceiling_slab.allocate_size) { return m_mtu_ceiling_slab.alloc(); }
|
||||
return create_packet(allocate);
|
||||
}
|
||||
static int const mtu_floor_size = TORRENT_INET_MIN_MTU - TORRENT_IPV4_HEADER - TORRENT_UDP_HEADER;
|
||||
static int const mtu_ceiling_size = TORRENT_ETHERNET_MTU - TORRENT_IPV4_HEADER - TORRENT_UDP_HEADER;
|
||||
constexpr static int mtu_floor_size = TORRENT_INET_MIN_MTU - TORRENT_IPV4_HEADER - TORRENT_UDP_HEADER;
|
||||
constexpr static int mtu_ceiling_size = TORRENT_ETHERNET_MTU - TORRENT_IPV4_HEADER - TORRENT_UDP_HEADER;
|
||||
packet_slab m_syn_slab;
|
||||
packet_slab m_mtu_floor_slab;
|
||||
packet_slab m_mtu_ceiling_slab;
|
||||
|
|
|
@ -133,9 +133,10 @@ namespace libtorrent {
|
|||
void release_packet(packet_ptr p) { m_packet_pool.release(std::move(p)); }
|
||||
void decay() { m_packet_pool.decay(); }
|
||||
|
||||
private:
|
||||
// explicitly disallow assignment, to silence msvc warning
|
||||
utp_socket_manager& operator=(utp_socket_manager const&);
|
||||
utp_socket_manager& operator=(utp_socket_manager const&) = delete;
|
||||
|
||||
private:
|
||||
|
||||
send_fun_t m_send_fun;
|
||||
incoming_utp_callback_t m_cb;
|
||||
|
|
|
@ -196,8 +196,8 @@ struct TORRENT_EXTRA_EXPORT utp_stream
|
|||
~utp_stream();
|
||||
utp_stream& operator=(utp_stream const&) = delete;
|
||||
utp_stream(utp_stream const&) = delete;
|
||||
utp_stream& operator=(utp_stream&&) noexcept = default;
|
||||
utp_stream(utp_stream&&) noexcept = default;
|
||||
utp_stream& operator=(utp_stream&&) noexcept = delete;
|
||||
utp_stream(utp_stream&&) noexcept = delete;
|
||||
|
||||
lowest_layer_type& lowest_layer() { return *this; }
|
||||
|
||||
|
|
|
@ -181,8 +181,7 @@ namespace libtorrent {
|
|||
return utp_incoming_packet(m_last_socket, p, ep, receive_time);
|
||||
}
|
||||
|
||||
std::pair<socket_map_t::iterator, socket_map_t::iterator> r =
|
||||
m_utp_sockets.equal_range(id);
|
||||
auto r = m_utp_sockets.equal_range(id);
|
||||
|
||||
for (; r.first != r.second; ++r.first)
|
||||
{
|
||||
|
|
|
@ -305,14 +305,11 @@ struct utp_socket_impl
|
|||
packet_ptr acquire_packet(int const allocate) { return m_sm.acquire_packet(allocate); }
|
||||
void release_packet(packet_ptr p) { m_sm.release_packet(std::move(p)); }
|
||||
|
||||
private:
|
||||
|
||||
// non-copyable
|
||||
utp_socket_impl(utp_socket_impl const&) = delete;
|
||||
utp_socket_impl const& operator=(utp_socket_impl const&) = delete;
|
||||
|
||||
// TODO: 2 it would be nice if not everything would have to be public here
|
||||
public:
|
||||
|
||||
void check_receive_buffers() const;
|
||||
|
||||
|
@ -920,7 +917,7 @@ void utp_stream::on_write(void* self, std::size_t const bytes_transferred
|
|||
}
|
||||
}
|
||||
|
||||
void utp_stream::on_connect(void* self, error_code const& ec, bool shutdown)
|
||||
void utp_stream::on_connect(void* self, error_code const& ec, bool const shutdown)
|
||||
{
|
||||
auto* s = static_cast<utp_stream*>(self);
|
||||
TORRENT_ASSERT(s);
|
||||
|
@ -3475,7 +3472,7 @@ int utp_socket_impl::packet_timeout() const
|
|||
return timeout;
|
||||
}
|
||||
|
||||
void utp_socket_impl::tick(time_point now)
|
||||
void utp_socket_impl::tick(time_point const now)
|
||||
{
|
||||
INVARIANT_CHECK;
|
||||
|
||||
|
|
Loading…
Reference in New Issue