diff --git a/include/libtorrent/bt_peer_connection.hpp b/include/libtorrent/bt_peer_connection.hpp index eb7cd750b..94f30b1eb 100644 --- a/include/libtorrent/bt_peer_connection.hpp +++ b/include/libtorrent/bt_peer_connection.hpp @@ -271,7 +271,6 @@ namespace libtorrent { template void send_message(message_type const type , counters::stats_counter_t const counter - , std::uint32_t flags , Args... args) { TORRENT_ASSERT(m_sent_handshake); @@ -285,7 +284,7 @@ namespace libtorrent { int tmp[] = {0, (detail::write_int32(args, ptr), 0)...}; TORRENT_UNUSED(tmp); - send_buffer(msg, flags); + send_buffer(msg); stats_counters().inc_stats_counter(counter); } diff --git a/include/libtorrent/peer_connection.hpp b/include/libtorrent/peer_connection.hpp index 7dfa3574e..f988c2bc5 100644 --- a/include/libtorrent/peer_connection.hpp +++ b/include/libtorrent/peer_connection.hpp @@ -617,8 +617,7 @@ namespace aux { // value invalid (the default constructor). virtual piece_block_progress downloading_piece_progress() const; - enum message_type_flags { message_type_request = 1 }; - void send_buffer(span buf, std::uint32_t flags = 0); + void send_buffer(span buf); void setup_send(); template diff --git a/include/libtorrent/peer_connection_handle.hpp b/include/libtorrent/peer_connection_handle.hpp index c0509f68a..7331018f7 100644 --- a/include/libtorrent/peer_connection_handle.hpp +++ b/include/libtorrent/peer_connection_handle.hpp @@ -100,7 +100,7 @@ struct TORRENT_EXPORT peer_connection_handle 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; time_point time_of_last_unchoke() const; diff --git a/src/bt_peer_connection.cpp b/src/bt_peer_connection.cpp index abe8153c2..e43c51668 100644 --- a/src/bt_peer_connection.cpp +++ b/src/bt_peer_connection.cpp @@ -349,7 +349,7 @@ namespace { #ifndef TORRENT_DISABLE_LOGGING peer_log(peer_log_alert::outgoing_message, "HAVE_ALL"); #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() @@ -359,7 +359,7 @@ namespace { #ifndef TORRENT_DISABLE_LOGGING peer_log(peer_log_alert::outgoing_message, "HAVE_NONE"); #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) @@ -376,7 +376,7 @@ namespace { , r.start, r.length); #endif - send_message(msg_reject_request, counters::num_outgoing_reject, 0 + send_message(msg_reject_request, counters::num_outgoing_reject , static_cast(r.piece), r.start, r.length); } @@ -393,7 +393,7 @@ namespace { 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(piece)); } @@ -421,7 +421,7 @@ namespace { } #endif - send_message(msg_suggest_piece, counters::num_outgoing_suggest, 0 + send_message(msg_suggest_piece, counters::num_outgoing_suggest , static_cast(piece)); } @@ -1939,7 +1939,7 @@ namespace { { INVARIANT_CHECK; - send_message(msg_cancel, counters::num_outgoing_cancel, 0 + send_message(msg_cancel, counters::num_outgoing_cancel , static_cast(r.piece), r.start, r.length); if (!m_supports_fast) incoming_reject_request(r); @@ -1949,7 +1949,7 @@ namespace { { INVARIANT_CHECK; - send_message(msg_request, counters::num_outgoing_request, message_type_request + send_message(msg_request, counters::num_outgoing_request , static_cast(r.piece), r.start, r.length); } @@ -2195,14 +2195,14 @@ namespace { INVARIANT_CHECK; 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() { INVARIANT_CHECK; - send_message(msg_unchoke, counters::num_outgoing_unchoke, 0); + send_message(msg_unchoke, counters::num_outgoing_unchoke); #ifndef TORRENT_DISABLE_EXTENSIONS for (auto const& e : m_extensions) @@ -2216,14 +2216,14 @@ namespace { { 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() { 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) @@ -2237,7 +2237,7 @@ namespace { // there instead if (!m_sent_bitfield) return; - send_message(msg_have, counters::num_outgoing_have, 0 + send_message(msg_have, counters::num_outgoing_have , static_cast(index)); } diff --git a/src/http_seed_connection.cpp b/src/http_seed_connection.cpp index 486cf85bf..3aad0002c 100644 --- a/src/http_seed_connection.cpp +++ b/src/http_seed_connection.cpp @@ -191,7 +191,7 @@ namespace libtorrent { peer_log(peer_log_alert::outgoing_message, "REQUEST", "%s", request.c_str()); #endif - send_buffer(request, message_type_request); + send_buffer(request); } // -------------------------- diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index dcd3245a3..a2b7495a8 100644 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -5726,10 +5726,9 @@ namespace libtorrent { return {}; } - void peer_connection::send_buffer(span buf, std::uint32_t const flags) + void peer_connection::send_buffer(span buf) { TORRENT_ASSERT(is_single_thread()); - TORRENT_UNUSED(flags); int const free_space = std::min( m_send_buffer.space_in_last_buffer(), int(buf.size())); diff --git a/src/peer_connection_handle.cpp b/src/peer_connection_handle.cpp index 98c86b571..09abcde17 100644 --- a/src/peer_connection_handle.cpp +++ b/src/peer_connection_handle.cpp @@ -278,12 +278,11 @@ bool peer_connection_handle::in_handshake() const return pc->in_handshake(); } -void peer_connection_handle::send_buffer(char const* begin, int size - , std::uint32_t const flags) +void peer_connection_handle::send_buffer(char const* begin, int size) { std::shared_ptr pc = native_handle(); TORRENT_ASSERT(pc); - pc->send_buffer({begin, size}, flags); + pc->send_buffer({begin, size}); } std::time_t peer_connection_handle::last_seen_complete() const diff --git a/src/web_peer_connection.cpp b/src/web_peer_connection.cpp index fe7511412..dba62d69a 100644 --- a/src/web_peer_connection.cpp +++ b/src/web_peer_connection.cpp @@ -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()); #endif - send_buffer(request, message_type_request); + send_buffer(request); } namespace {