remove unused flags parameter to send_buffer() and send_message() on peer_connections

This commit is contained in:
Arvid Norberg 2019-03-18 12:09:27 +01:00 committed by Arvid Norberg
parent ad540ead79
commit 28d5b7d427
8 changed files with 20 additions and 24 deletions

View File

@ -271,7 +271,6 @@ namespace libtorrent {
template <typename... Args> template <typename... Args>
void send_message(message_type const type void send_message(message_type const type
, counters::stats_counter_t const counter , counters::stats_counter_t const counter
, std::uint32_t flags
, Args... args) , Args... args)
{ {
TORRENT_ASSERT(m_sent_handshake); TORRENT_ASSERT(m_sent_handshake);
@ -285,7 +284,7 @@ namespace libtorrent {
int tmp[] = {0, (detail::write_int32(args, ptr), 0)...}; int tmp[] = {0, (detail::write_int32(args, ptr), 0)...};
TORRENT_UNUSED(tmp); TORRENT_UNUSED(tmp);
send_buffer(msg, flags); send_buffer(msg);
stats_counters().inc_stats_counter(counter); stats_counters().inc_stats_counter(counter);
} }

View File

@ -617,8 +617,7 @@ namespace aux {
// value invalid (the default constructor). // value invalid (the default constructor).
virtual piece_block_progress downloading_piece_progress() const; virtual piece_block_progress downloading_piece_progress() const;
enum message_type_flags { message_type_request = 1 }; void send_buffer(span<char const> buf);
void send_buffer(span<char const> buf, std::uint32_t flags = 0);
void setup_send(); void setup_send();
template <typename Holder> template <typename Holder>

View File

@ -100,7 +100,7 @@ struct TORRENT_EXPORT peer_connection_handle
bool in_handshake() const; bool in_handshake() const;
void send_buffer(char const* begin, int size, std::uint32_t flags = 0); void send_buffer(char const* begin, int size);
std::time_t last_seen_complete() const; std::time_t last_seen_complete() const;
time_point time_of_last_unchoke() const; time_point time_of_last_unchoke() const;

View File

@ -349,7 +349,7 @@ namespace {
#ifndef TORRENT_DISABLE_LOGGING #ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::outgoing_message, "HAVE_ALL"); peer_log(peer_log_alert::outgoing_message, "HAVE_ALL");
#endif #endif
send_message(msg_have_all, counters::num_outgoing_have_all, 0); send_message(msg_have_all, counters::num_outgoing_have_all);
} }
void bt_peer_connection::write_have_none() void bt_peer_connection::write_have_none()
@ -359,7 +359,7 @@ namespace {
#ifndef TORRENT_DISABLE_LOGGING #ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::outgoing_message, "HAVE_NONE"); peer_log(peer_log_alert::outgoing_message, "HAVE_NONE");
#endif #endif
send_message(msg_have_none, counters::num_outgoing_have_none, 0); send_message(msg_have_none, counters::num_outgoing_have_none);
} }
void bt_peer_connection::write_reject_request(peer_request const& r) void bt_peer_connection::write_reject_request(peer_request const& r)
@ -376,7 +376,7 @@ namespace {
, r.start, r.length); , r.start, r.length);
#endif #endif
send_message(msg_reject_request, counters::num_outgoing_reject, 0 send_message(msg_reject_request, counters::num_outgoing_reject
, static_cast<int>(r.piece), r.start, r.length); , static_cast<int>(r.piece), r.start, r.length);
} }
@ -393,7 +393,7 @@ namespace {
TORRENT_ASSERT(associated_torrent().lock()->valid_metadata()); TORRENT_ASSERT(associated_torrent().lock()->valid_metadata());
send_message(msg_allowed_fast, counters::num_outgoing_allowed_fast, 0 send_message(msg_allowed_fast, counters::num_outgoing_allowed_fast
, static_cast<int>(piece)); , static_cast<int>(piece));
} }
@ -421,7 +421,7 @@ namespace {
} }
#endif #endif
send_message(msg_suggest_piece, counters::num_outgoing_suggest, 0 send_message(msg_suggest_piece, counters::num_outgoing_suggest
, static_cast<int>(piece)); , static_cast<int>(piece));
} }
@ -1939,7 +1939,7 @@ namespace {
{ {
INVARIANT_CHECK; INVARIANT_CHECK;
send_message(msg_cancel, counters::num_outgoing_cancel, 0 send_message(msg_cancel, counters::num_outgoing_cancel
, static_cast<int>(r.piece), r.start, r.length); , static_cast<int>(r.piece), r.start, r.length);
if (!m_supports_fast) incoming_reject_request(r); if (!m_supports_fast) incoming_reject_request(r);
@ -1949,7 +1949,7 @@ namespace {
{ {
INVARIANT_CHECK; INVARIANT_CHECK;
send_message(msg_request, counters::num_outgoing_request, message_type_request send_message(msg_request, counters::num_outgoing_request
, static_cast<int>(r.piece), r.start, r.length); , static_cast<int>(r.piece), r.start, r.length);
} }
@ -2195,14 +2195,14 @@ namespace {
INVARIANT_CHECK; INVARIANT_CHECK;
if (is_choked()) return; if (is_choked()) return;
send_message(msg_choke, counters::num_outgoing_choke, 0); send_message(msg_choke, counters::num_outgoing_choke);
} }
void bt_peer_connection::write_unchoke() void bt_peer_connection::write_unchoke()
{ {
INVARIANT_CHECK; INVARIANT_CHECK;
send_message(msg_unchoke, counters::num_outgoing_unchoke, 0); send_message(msg_unchoke, counters::num_outgoing_unchoke);
#ifndef TORRENT_DISABLE_EXTENSIONS #ifndef TORRENT_DISABLE_EXTENSIONS
for (auto const& e : m_extensions) for (auto const& e : m_extensions)
@ -2216,14 +2216,14 @@ namespace {
{ {
INVARIANT_CHECK; INVARIANT_CHECK;
send_message(msg_interested, counters::num_outgoing_interested, 0); send_message(msg_interested, counters::num_outgoing_interested);
} }
void bt_peer_connection::write_not_interested() void bt_peer_connection::write_not_interested()
{ {
INVARIANT_CHECK; INVARIANT_CHECK;
send_message(msg_not_interested, counters::num_outgoing_not_interested, 0); send_message(msg_not_interested, counters::num_outgoing_not_interested);
} }
void bt_peer_connection::write_have(piece_index_t const index) void bt_peer_connection::write_have(piece_index_t const index)
@ -2237,7 +2237,7 @@ namespace {
// there instead // there instead
if (!m_sent_bitfield) return; if (!m_sent_bitfield) return;
send_message(msg_have, counters::num_outgoing_have, 0 send_message(msg_have, counters::num_outgoing_have
, static_cast<int>(index)); , static_cast<int>(index));
} }

View File

@ -191,7 +191,7 @@ namespace libtorrent {
peer_log(peer_log_alert::outgoing_message, "REQUEST", "%s", request.c_str()); peer_log(peer_log_alert::outgoing_message, "REQUEST", "%s", request.c_str());
#endif #endif
send_buffer(request, message_type_request); send_buffer(request);
} }
// -------------------------- // --------------------------

View File

@ -5726,10 +5726,9 @@ namespace libtorrent {
return {}; return {};
} }
void peer_connection::send_buffer(span<char const> buf, std::uint32_t const flags) void peer_connection::send_buffer(span<char const> buf)
{ {
TORRENT_ASSERT(is_single_thread()); TORRENT_ASSERT(is_single_thread());
TORRENT_UNUSED(flags);
int const free_space = std::min( int const free_space = std::min(
m_send_buffer.space_in_last_buffer(), int(buf.size())); m_send_buffer.space_in_last_buffer(), int(buf.size()));

View File

@ -278,12 +278,11 @@ bool peer_connection_handle::in_handshake() const
return pc->in_handshake(); return pc->in_handshake();
} }
void peer_connection_handle::send_buffer(char const* begin, int size void peer_connection_handle::send_buffer(char const* begin, int size)
, std::uint32_t const flags)
{ {
std::shared_ptr<peer_connection> pc = native_handle(); std::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc); TORRENT_ASSERT(pc);
pc->send_buffer({begin, size}, flags); pc->send_buffer({begin, size});
} }
std::time_t peer_connection_handle::last_seen_complete() const std::time_t peer_connection_handle::last_seen_complete() const

View File

@ -463,7 +463,7 @@ void web_peer_connection::write_request(peer_request const& r)
peer_log(peer_log_alert::outgoing_message, "REQUEST", "%s", request.c_str()); peer_log(peer_log_alert::outgoing_message, "REQUEST", "%s", request.c_str());
#endif #endif
send_buffer(request, message_type_request); send_buffer(request);
} }
namespace { namespace {