minor code cleanup in http_tracker_connection code

This commit is contained in:
Alden Torres 2018-02-20 12:55:21 -05:00 committed by Arvid Norberg
parent 53b4725da3
commit 2ac84ed5f5
2 changed files with 5 additions and 15 deletions

View File

@ -33,27 +33,21 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_HTTP_TRACKER_CONNECTION_HPP_INCLUDED #ifndef TORRENT_HTTP_TRACKER_CONNECTION_HPP_INCLUDED
#define TORRENT_HTTP_TRACKER_CONNECTION_HPP_INCLUDED #define TORRENT_HTTP_TRACKER_CONNECTION_HPP_INCLUDED
#include <string>
#include <vector> #include <vector>
#include <memory> #include <memory>
#include "libtorrent/config.hpp" #include "libtorrent/config.hpp"
#include "libtorrent/lazy_entry.hpp"
#include "libtorrent/peer_id.hpp" #include "libtorrent/peer_id.hpp"
#include "libtorrent/tracker_manager.hpp"
#include "libtorrent/i2p_stream.hpp"
#include "libtorrent/error_code.hpp" #include "libtorrent/error_code.hpp"
namespace libtorrent { namespace libtorrent {
class tracker_manager;
struct http_connection; struct http_connection;
class entry;
class http_parser; class http_parser;
struct bdecode_node; struct bdecode_node;
struct peer_entry; struct peer_entry;
namespace aux { struct session_settings; }
class TORRENT_EXTRA_EXPORT http_tracker_connection class TORRENT_EXTRA_EXPORT http_tracker_connection
: public tracker_connection : public tracker_connection
{ {

View File

@ -31,9 +31,9 @@ POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "libtorrent/config.hpp" #include "libtorrent/config.hpp"
#include "libtorrent/gzip.hpp"
#include "libtorrent/socket_io.hpp" #include "libtorrent/socket_io.hpp"
#include <string>
#include <functional> #include <functional>
#include <vector> #include <vector>
#include <list> #include <list>
@ -45,19 +45,14 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/tracker_manager.hpp" #include "libtorrent/tracker_manager.hpp"
#include "libtorrent/http_tracker_connection.hpp" #include "libtorrent/http_tracker_connection.hpp"
#include "libtorrent/http_connection.hpp" #include "libtorrent/http_connection.hpp"
#include "libtorrent/entry.hpp" #include "libtorrent/aux_/escape_string.hpp"
#include "libtorrent/bencode.hpp"
#include "libtorrent/torrent.hpp"
#include "libtorrent/io.hpp" #include "libtorrent/io.hpp"
#include "libtorrent/socket.hpp" #include "libtorrent/socket.hpp"
#include "libtorrent/broadcast_socket.hpp" // for is_local
#include "libtorrent/string_util.hpp" // for is_i2p_url #include "libtorrent/string_util.hpp" // for is_i2p_url
#include "libtorrent/aux_/session_settings.hpp" #include "libtorrent/aux_/session_settings.hpp"
#include "libtorrent/resolver_interface.hpp" #include "libtorrent/resolver_interface.hpp"
#include "libtorrent/ip_filter.hpp" #include "libtorrent/ip_filter.hpp"
using namespace std::placeholders;
namespace libtorrent { namespace libtorrent {
http_tracker_connection::http_tracker_connection( http_tracker_connection::http_tracker_connection(
@ -197,6 +192,7 @@ namespace libtorrent {
return; return;
} }
using namespace std::placeholders;
m_tracker_connection = std::make_shared<http_connection>(get_io_service(), m_man.host_resolver() m_tracker_connection = std::make_shared<http_connection>(get_io_service(), m_man.host_resolver()
, std::bind(&http_tracker_connection::on_response, shared_from_this(), _1, _2, _3) , std::bind(&http_tracker_connection::on_response, shared_from_this(), _1, _2, _3)
, true, settings.get_int(settings_pack::max_http_recv_buffer_size) , true, settings.get_int(settings_pack::max_http_recv_buffer_size)
@ -394,7 +390,7 @@ namespace libtorrent {
else else
{ {
// if there's no peer_id, just initialize it to a bunch of zeroes // if there's no peer_id, just initialize it to a bunch of zeroes
std::fill_n(ret.pid.begin(), 20, 0); ret.pid.clear();
} }
// extract ip // extract ip