making tracker_manager::remove_request type specific
This commit is contained in:
parent
3a92908f39
commit
21fb0e8c20
|
@ -286,7 +286,6 @@ namespace libtorrent
|
|||
#endif
|
||||
};
|
||||
|
||||
// TODO: 2 this class probably doesn't need to have virtual functions.
|
||||
struct TORRENT_EXTRA_EXPORT tracker_connection
|
||||
: timeout_handler
|
||||
{
|
||||
|
@ -303,7 +302,7 @@ namespace libtorrent
|
|||
void fail(error_code const& ec, int code = -1, char const* msg = ""
|
||||
, int interval = 0, int min_interval = 0);
|
||||
virtual void start() = 0;
|
||||
virtual void close();
|
||||
virtual void close() = 0;
|
||||
address const& bind_interface() const { return m_req.bind_ip; }
|
||||
void sent_bytes(int bytes);
|
||||
void received_bytes(int bytes);
|
||||
|
@ -359,7 +358,8 @@ namespace libtorrent
|
|||
= std::weak_ptr<request_callback>());
|
||||
void abort_all_requests(bool all = false);
|
||||
|
||||
void remove_request(tracker_connection const*);
|
||||
void remove_request(http_tracker_connection const* c);
|
||||
void remove_request(udp_tracker_connection const* c);
|
||||
bool empty() const;
|
||||
int num_requests() const;
|
||||
|
||||
|
|
|
@ -253,7 +253,8 @@ namespace libtorrent
|
|||
m_tracker_connection->close();
|
||||
m_tracker_connection.reset();
|
||||
}
|
||||
tracker_connection::close();
|
||||
cancel();
|
||||
m_man.remove_request(this);
|
||||
}
|
||||
|
||||
// endpoints is an in-out parameter
|
||||
|
|
|
@ -196,12 +196,6 @@ namespace libtorrent
|
|||
m_man.received_bytes(bytes);
|
||||
}
|
||||
|
||||
void tracker_connection::close()
|
||||
{
|
||||
cancel();
|
||||
m_man.remove_request(this);
|
||||
}
|
||||
|
||||
tracker_manager::tracker_manager(send_fun_t const& send_fun
|
||||
, send_fun_hostname_t const& send_fun_hostname
|
||||
, counters& stats_counters
|
||||
|
@ -238,7 +232,7 @@ namespace libtorrent
|
|||
m_stats_counters.inc_stats_counter(counters::recv_tracker_bytes, bytes);
|
||||
}
|
||||
|
||||
void tracker_manager::remove_request(tracker_connection const* c)
|
||||
void tracker_manager::remove_request(http_tracker_connection const* c)
|
||||
{
|
||||
TORRENT_ASSERT(is_single_thread());
|
||||
http_conns_t::iterator i = std::find_if(m_http_conns.begin(), m_http_conns.end()
|
||||
|
@ -248,14 +242,12 @@ namespace libtorrent
|
|||
m_http_conns.erase(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
udp_conns_t::iterator j = std::find_if(m_udp_conns.begin(), m_udp_conns.end()
|
||||
, [c] (udp_conns_t::value_type const& uc) { return uc.second.get() == c; });
|
||||
if (j != m_udp_conns.end())
|
||||
{
|
||||
m_udp_conns.erase(j);
|
||||
return;
|
||||
}
|
||||
void tracker_manager::remove_request(udp_tracker_connection const* c)
|
||||
{
|
||||
TORRENT_ASSERT(is_single_thread());
|
||||
m_udp_conns.erase(c->transaction_id());
|
||||
}
|
||||
|
||||
void tracker_manager::update_transaction_id(
|
||||
|
|
|
@ -329,8 +329,8 @@ namespace libtorrent
|
|||
|
||||
void udp_tracker_connection::close()
|
||||
{
|
||||
error_code ec;
|
||||
tracker_connection::close();
|
||||
cancel();
|
||||
m_man.remove_request(this);
|
||||
}
|
||||
|
||||
bool udp_tracker_connection::on_receive_hostname(char const* hostname
|
||||
|
|
Loading…
Reference in New Issue