optimized header dependencies to lower build time
This commit is contained in:
parent
562e2512b9
commit
6343fe6a6d
1
Jamfile
1
Jamfile
|
@ -356,6 +356,7 @@ SOURCES =
|
|||
session
|
||||
session_impl
|
||||
socket_io
|
||||
socket_type
|
||||
socks5_stream
|
||||
stat
|
||||
storage
|
||||
|
|
|
@ -3560,7 +3560,7 @@ session_settings
|
|||
int inactivity_timeout;
|
||||
int unchoke_interval;
|
||||
int optimistic_unchoke_interval;
|
||||
address announce_ip;
|
||||
std::string announce_ip;
|
||||
int num_want;
|
||||
int initial_picker_threshold;
|
||||
int allowed_fast_set_size;
|
||||
|
@ -3767,7 +3767,7 @@ each *optimistic* unchoke. On this timer, the currently optimistically
|
|||
unchoked peer will change.
|
||||
|
||||
``announce_ip`` is the ip address passed along to trackers as the ``&ip=`` parameter.
|
||||
If left as the default (default constructed), that parameter is ommited.
|
||||
If left as the default (an empty string), that parameter is omitted.
|
||||
|
||||
``num_want`` is the number of peers we want from each tracker request. It defines
|
||||
what is sent as the ``&num_want=`` parameter to the tracker.
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2009, Arvid Norberg
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the author nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef TORRENT_ADDRESS_HPP_INCLUDED
|
||||
#define TORRENT_ADDRESS_HPP_INCLUDED
|
||||
|
||||
#include <boost/version.hpp>
|
||||
|
||||
#ifdef __OBJC__
|
||||
#define Protocol Protocol_
|
||||
#endif
|
||||
|
||||
#if BOOST_VERSION < 103500
|
||||
#include <asio/ip/address.hpp>
|
||||
#else
|
||||
#include <boost/asio/ip/address.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef __OBJC__
|
||||
#undef Protocol
|
||||
#endif
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
||||
#if BOOST_VERSION < 103500
|
||||
typedef ::asio::ip::address address;
|
||||
typedef ::asio::ip::address_v4 address_v4;
|
||||
typedef ::asio::ip::address_v6 address_v6;
|
||||
#else
|
||||
typedef boost::asio::ip::address address;
|
||||
typedef boost::asio::ip::address_v4 address_v4;
|
||||
typedef boost::asio::ip::address_v6 address_v6;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -36,13 +36,12 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <memory>
|
||||
#include <queue>
|
||||
#include <string>
|
||||
#include <typeinfo>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push, 1)
|
||||
#endif
|
||||
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/function/function1.hpp>
|
||||
|
||||
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
|
@ -57,7 +56,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/assert.hpp"
|
||||
#include "libtorrent/thread.hpp"
|
||||
#include "libtorrent/socket.hpp" // for io_service
|
||||
#include "libtorrent/io_service_fwd.hpp"
|
||||
|
||||
#ifndef TORRENT_MAX_ALERT_TYPES
|
||||
#define TORRENT_MAX_ALERT_TYPES 15
|
||||
|
|
|
@ -36,11 +36,11 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/alert.hpp"
|
||||
#include "libtorrent/torrent_handle.hpp"
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/peer_connection.hpp"
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/assert.hpp"
|
||||
#include "libtorrent/identify_client.hpp"
|
||||
#include "libtorrent/socket_io.hpp"
|
||||
#include "libtorrent/address.hpp"
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
|
|
@ -82,6 +82,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/deadline_timer.hpp"
|
||||
#include "libtorrent/socket_io.hpp" // for print_address
|
||||
#include "libtorrent/peer_connection.hpp" // for intrusive_ptr_release
|
||||
#include "libtorrent/address.hpp"
|
||||
|
||||
#ifdef TORRENT_STATS
|
||||
#include <fstream>
|
||||
|
|
|
@ -34,10 +34,12 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#define TORRENT_BROADCAST_SOCKET_HPP_INCLUDED
|
||||
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/io_service_fwd.hpp"
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/address.hpp"
|
||||
#include "libtorrent/error_code.hpp"
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/function/function3.hpp>
|
||||
#include <list>
|
||||
|
||||
namespace libtorrent
|
||||
|
|
|
@ -59,7 +59,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/peer_connection.hpp"
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/peer_id.hpp"
|
||||
#include "libtorrent/storage.hpp"
|
||||
#include "libtorrent/stat.hpp"
|
||||
#include "libtorrent/alert.hpp"
|
||||
#include "libtorrent/torrent_handle.hpp"
|
||||
|
|
|
@ -32,7 +32,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef LIBTORRENT_BUFFER_HPP
|
||||
#define LIBTORRENT_BUFFER_HPP
|
||||
|
||||
#include <memory>
|
||||
#include <cstring>
|
||||
#include "libtorrent/invariant_check.hpp"
|
||||
#include "libtorrent/assert.hpp"
|
||||
|
|
|
@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef TORRENT_CHAINED_BUFFER_HPP_INCLUDED
|
||||
#define TORRENT_CHAINED_BUFFER_HPP_INCLUDED
|
||||
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/function/function1.hpp>
|
||||
#include <boost/version.hpp>
|
||||
#if BOOST_VERSION < 103500
|
||||
#include <asio/buffer.hpp>
|
||||
|
|
|
@ -34,9 +34,10 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#define TORRENT_CONNECTION_QUEUE
|
||||
|
||||
#include <list>
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/function/function1.hpp>
|
||||
#include <boost/function/function0.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/io_service.hpp"
|
||||
#include "libtorrent/error_code.hpp"
|
||||
#include "libtorrent/deadline_timer.hpp"
|
||||
|
||||
|
|
|
@ -52,8 +52,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#pragma warning(push, 1)
|
||||
#endif
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
||||
#include <boost/date_time/posix_time/ptime.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
|
@ -63,7 +62,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
namespace libtorrent
|
||||
{
|
||||
namespace pt = boost::posix_time;
|
||||
class torrent_info;
|
||||
|
||||
struct TORRENT_EXPORT create_torrent
|
||||
|
@ -118,7 +116,7 @@ namespace libtorrent
|
|||
// if a creation date is found in the torrent file
|
||||
// this will be set to that, otherwise it'll be
|
||||
// 1970, Jan 1
|
||||
pt::ptime m_creation_date;
|
||||
boost::posix_time::ptime m_creation_date;
|
||||
|
||||
// if a comment is found in the torrent file
|
||||
// this will be set to that comment
|
||||
|
|
|
@ -39,8 +39,10 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/storage.hpp"
|
||||
#include "libtorrent/allocator.hpp"
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include "libtorrent/io_service.hpp"
|
||||
|
||||
#include <boost/function/function0.hpp>
|
||||
#include <boost/function/function2.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/shared_array.hpp>
|
||||
#include <list>
|
||||
|
@ -396,7 +398,7 @@ namespace libtorrent
|
|||
// disk_io_thread. If the event refers to a disk buffer
|
||||
// it will try to free it, but the buffer pool won't
|
||||
// exist anymore, and crash. This prevents that.
|
||||
boost::optional<asio::io_service::work> m_work;
|
||||
boost::optional<io_service::work> m_work;
|
||||
|
||||
// thread for performing blocking disk io operations
|
||||
thread m_disk_io_thread;
|
||||
|
|
|
@ -68,6 +68,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/assert.hpp"
|
||||
#include "libtorrent/error_code.hpp"
|
||||
#include "libtorrent/max.hpp"
|
||||
|
||||
#if TORRENT_USE_IOSTREAM
|
||||
#include <iosfwd>
|
||||
|
@ -81,32 +82,6 @@ namespace libtorrent
|
|||
type_error(const char* error): std::runtime_error(error) {}
|
||||
};
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template<int v1, int v2>
|
||||
struct max2 { enum { value = v1>v2?v1:v2 }; };
|
||||
|
||||
template<int v1, int v2, int v3>
|
||||
struct max3
|
||||
{
|
||||
enum
|
||||
{
|
||||
temp = max2<v1,v2>::value,
|
||||
value = temp>v3?temp:v3
|
||||
};
|
||||
};
|
||||
|
||||
template<int v1, int v2, int v3, int v4>
|
||||
struct max4
|
||||
{
|
||||
enum
|
||||
{
|
||||
temp = max3<v1,v2, v3>::value,
|
||||
value = temp>v4?temp:v4
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
class entry;
|
||||
|
||||
class TORRENT_EXPORT entry
|
||||
|
@ -195,7 +170,7 @@ namespace libtorrent
|
|||
union
|
||||
{
|
||||
char data[
|
||||
detail::max4<sizeof(std::list<char>)
|
||||
max4<sizeof(std::list<char>)
|
||||
, sizeof(std::map<std::string, char>)
|
||||
, sizeof(string_type)
|
||||
, sizeof(integer_type)>::value];
|
||||
|
@ -204,7 +179,7 @@ namespace libtorrent
|
|||
#else
|
||||
union
|
||||
{
|
||||
char data[detail::max4<sizeof(list_type)
|
||||
char data[max4<sizeof(list_type)
|
||||
, sizeof(dictionary_type)
|
||||
, sizeof(string_type)
|
||||
, sizeof(integer_type)>::value];
|
||||
|
|
|
@ -34,7 +34,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#define TORRENT_ENUM_NET_HPP_INCLUDED
|
||||
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include <vector>
|
||||
#include "libtorrent/io_service_fwd.hpp"
|
||||
#include "libtorrent/address.hpp"
|
||||
#include "libtorrent/error_code.hpp"
|
||||
|
||||
namespace libtorrent
|
||||
|
|
|
@ -34,7 +34,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#define TORRENT_ERROR_CODE_HPP_INCLUDED
|
||||
|
||||
#include <boost/version.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#if BOOST_VERSION < 103500
|
||||
#include <asio/error_code.hpp>
|
||||
|
@ -228,17 +227,22 @@ namespace libtorrent
|
|||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
struct TORRENT_EXPORT libtorrent_exception: std::exception
|
||||
{
|
||||
libtorrent_exception(error_code const& s): m_error(s) {}
|
||||
libtorrent_exception(error_code const& s): m_error(s), m_msg(0) {}
|
||||
virtual const char* what() const throw()
|
||||
{
|
||||
if (!m_msg) m_msg.reset(new std::string(m_error.message()));
|
||||
return m_msg->c_str();
|
||||
if (!m_msg)
|
||||
{
|
||||
std::string msg = m_error.message();
|
||||
m_msg = strdup(msg.c_str());
|
||||
}
|
||||
|
||||
return m_msg;
|
||||
}
|
||||
virtual ~libtorrent_exception() throw() {}
|
||||
virtual ~libtorrent_exception() throw() { free(m_msg); }
|
||||
error_code error() const { return m_error; }
|
||||
private:
|
||||
error_code m_error;
|
||||
mutable boost::shared_ptr<std::string> m_msg;
|
||||
mutable char* m_msg;
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <string>
|
||||
#include <limits>
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/size_type.hpp"
|
||||
|
@ -72,7 +71,7 @@ namespace libtorrent
|
|||
TORRENT_EXPORT std::string base32encode(std::string const& s);
|
||||
TORRENT_EXPORT std::string base32decode(std::string const& s);
|
||||
|
||||
TORRENT_EXPORT boost::optional<std::string> url_has_argument(
|
||||
TORRENT_EXPORT std::string url_has_argument(
|
||||
std::string const& url, std::string argument);
|
||||
|
||||
// replaces \ with /
|
||||
|
|
|
@ -35,7 +35,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push, 1)
|
||||
|
@ -56,7 +55,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include <winbase.h>
|
||||
#include <winioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
|
|
@ -33,7 +33,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef TORRENT_HTTP_CONNECTION
|
||||
#define TORRENT_HTTP_CONNECTION
|
||||
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/function/function1.hpp>
|
||||
#include <boost/function/function2.hpp>
|
||||
#include <boost/function/function5.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/enable_shared_from_this.hpp>
|
||||
|
|
|
@ -35,7 +35,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <ctime>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <string>
|
||||
|
||||
|
@ -56,25 +55,17 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include "libtorrent/buffer.hpp"
|
||||
#include "libtorrent/peer_connection.hpp"
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/peer_id.hpp"
|
||||
#include "libtorrent/storage.hpp"
|
||||
#include "libtorrent/stat.hpp"
|
||||
#include "libtorrent/alert.hpp"
|
||||
#include "libtorrent/torrent_handle.hpp"
|
||||
#include "libtorrent/torrent.hpp"
|
||||
#include "libtorrent/peer_request.hpp"
|
||||
#include "libtorrent/piece_block_progress.hpp"
|
||||
#include "libtorrent/config.hpp"
|
||||
// parse_url
|
||||
#include "libtorrent/tracker_manager.hpp"
|
||||
#include "libtorrent/peer_connection.hpp"
|
||||
#include "libtorrent/disk_buffer_holder.hpp"
|
||||
#include "libtorrent/torrent.hpp"
|
||||
#include "libtorrent/piece_block_progress.hpp"
|
||||
#include "libtorrent/http_parser.hpp"
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
class torrent;
|
||||
struct peer_request;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
|
|
@ -33,7 +33,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef TORRENT_HTTP_STREAM_HPP_INCLUDED
|
||||
#define TORRENT_HTTP_STREAM_HPP_INCLUDED
|
||||
|
||||
#include <boost/function/function1.hpp>
|
||||
#include "libtorrent/proxy_base.hpp"
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
namespace libtorrent {
|
||||
|
||||
|
|
|
@ -37,6 +37,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#if TORRENT_USE_I2P
|
||||
|
||||
#include <boost/function/function1.hpp>
|
||||
#include <boost/function/function2.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include "libtorrent/proxy_base.hpp"
|
||||
#include "libtorrent/session_settings.hpp"
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2006, Arvid Norberg & Daniel Wallin
|
||||
Copyright (c) 2009, Arvid Norberg
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
@ -30,45 +30,43 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
*/
|
||||
|
||||
#ifndef TORRENT_RANDOM_SAMPLE_HPP
|
||||
#define TORRENT_RANDOM_SAMPLE_HPP
|
||||
#ifndef TORRENT_IO_SERVICE_HPP_INCLUDED
|
||||
#define TORRENT_IO_SERVICE_HPP_INCLUDED
|
||||
|
||||
#include <iterator>
|
||||
#include <cstdlib>
|
||||
#ifdef __OBJC__
|
||||
#define Protocol Protocol_
|
||||
#endif
|
||||
|
||||
#include "libtorrent/config.hpp"
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push, 1)
|
||||
#endif
|
||||
|
||||
#include <boost/version.hpp>
|
||||
|
||||
#if BOOST_VERSION < 103500
|
||||
#include <asio/io_service.hpp>
|
||||
#else
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __OBJC__
|
||||
#undef Protocol
|
||||
#endif
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
||||
template<class InIter, class OutIter, class Distance>
|
||||
inline void random_sample_n(InIter start, InIter end
|
||||
, OutIter out, Distance n)
|
||||
{
|
||||
Distance t = 0;
|
||||
Distance m = 0;
|
||||
Distance N = std::distance(start, end);
|
||||
|
||||
TORRENT_ASSERT(N >= n);
|
||||
|
||||
while (m < n)
|
||||
{
|
||||
if ((std::rand() / (RAND_MAX + 1.f)) * (N - t) >= n - m)
|
||||
{
|
||||
++start;
|
||||
++t;
|
||||
}
|
||||
else
|
||||
{
|
||||
*out = *start;
|
||||
++out;
|
||||
++start;
|
||||
++t;
|
||||
++m;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if BOOST_VERSION < 103500
|
||||
typedef ::asio::io_service io_service;
|
||||
#else
|
||||
typedef boost::asio::io_service io_service;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2009, Arvid Norberg
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the author nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef TORRENT_IO_SERVICE_FWD_HPP_INCLUDED
|
||||
#define TORRENT_IO_SERVICE_FWD_HPP_INCLUDED
|
||||
|
||||
#ifdef __OBJC__
|
||||
#define Protocol Protocol_
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push, 1)
|
||||
#endif
|
||||
|
||||
#include <boost/version.hpp>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __OBJC__
|
||||
#undef Protocol
|
||||
#endif
|
||||
|
||||
#if BOOST_VERSION >= 103500
|
||||
namespace boost {
|
||||
#endif
|
||||
namespace asio {
|
||||
|
||||
class io_service;
|
||||
|
||||
}
|
||||
#if BOOST_VERSION >= 103500
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
||||
#if BOOST_VERSION < 103500
|
||||
typedef ::asio::io_service io_service;
|
||||
#else
|
||||
typedef boost::asio::io_service io_service;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#define TORRENT_IP_FILTER_HPP
|
||||
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push, 1)
|
||||
|
@ -49,7 +50,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/address.hpp"
|
||||
#include "libtorrent/assert.hpp"
|
||||
|
||||
namespace libtorrent
|
||||
|
|
|
@ -40,7 +40,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <numeric>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/intrusive_ptr.hpp>
|
||||
#include <boost/detail/atomic_count.hpp>
|
||||
|
||||
|
|
|
@ -44,7 +44,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <libtorrent/kademlia/msg.hpp>
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/function/function1.hpp>
|
||||
#include <boost/function/function2.hpp>
|
||||
|
||||
namespace libtorrent { namespace dht
|
||||
{
|
||||
|
|
|
@ -49,10 +49,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <libtorrent/thread.hpp>
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/iterator/transform_iterator.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
#include "libtorrent/socket.hpp"
|
||||
|
||||
|
@ -181,7 +178,7 @@ typedef std::map<std::pair<node_id, sha1_hash>, search_torrent_entry> search_tab
|
|||
public:
|
||||
node_impl(libtorrent::aux::session_impl& ses
|
||||
, bool (*f)(void*, entry const&, udp::endpoint const&, int)
|
||||
, dht_settings const& settings, boost::optional<node_id> nid
|
||||
, dht_settings const& settings, node_id nid
|
||||
, void* userdata);
|
||||
|
||||
virtual ~node_impl() {}
|
||||
|
|
|
@ -35,6 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/kademlia/node_id.hpp"
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/address.hpp"
|
||||
|
||||
namespace libtorrent { namespace dht
|
||||
{
|
||||
|
|
|
@ -38,6 +38,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <boost/intrusive_ptr.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <libtorrent/time.hpp>
|
||||
#include <libtorrent/address.hpp>
|
||||
|
||||
namespace libtorrent {
|
||||
namespace dht {
|
||||
|
|
|
@ -37,8 +37,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <libtorrent/kademlia/node_id.hpp>
|
||||
#include <libtorrent/kademlia/find_data.hpp>
|
||||
|
||||
#include <boost/function.hpp>
|
||||
|
||||
namespace libtorrent { namespace dht
|
||||
{
|
||||
|
||||
|
|
|
@ -35,18 +35,13 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/pool/pool.hpp>
|
||||
|
||||
#include <libtorrent/socket.hpp>
|
||||
#include <libtorrent/entry.hpp>
|
||||
#include <libtorrent/kademlia/node_id.hpp>
|
||||
#include <libtorrent/kademlia/logging.hpp>
|
||||
#include <libtorrent/kademlia/node_entry.hpp>
|
||||
#include <libtorrent/kademlia/observer.hpp>
|
||||
|
||||
#include "libtorrent/time.hpp"
|
||||
|
|
|
@ -39,6 +39,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <libtorrent/kademlia/node_id.hpp>
|
||||
#include <libtorrent/kademlia/routing_table.hpp>
|
||||
#include <libtorrent/kademlia/logging.hpp>
|
||||
#include <libtorrent/address.hpp>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/intrusive_ptr.hpp>
|
||||
|
|
|
@ -39,7 +39,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/intrusive_ptr_base.hpp"
|
||||
#include "libtorrent/deadline_timer.hpp"
|
||||
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/function/function2.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
|
|
|
@ -33,13 +33,16 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef TORRENT_NATPMP_HPP
|
||||
#define TORRENT_NATPMP_HPP
|
||||
|
||||
#include "libtorrent/io_service_fwd.hpp"
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/address.hpp"
|
||||
#include "libtorrent/thread.hpp"
|
||||
#include "libtorrent/error_code.hpp"
|
||||
#include "libtorrent/intrusive_ptr_base.hpp"
|
||||
#include "libtorrent/deadline_timer.hpp"
|
||||
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/function/function1.hpp>
|
||||
#include <boost/function/function3.hpp>
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
|
|
@ -38,7 +38,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING
|
||||
#include "libtorrent/debug.hpp"
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push, 1)
|
||||
|
@ -46,6 +48,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <boost/smart_ptr.hpp>
|
||||
#include <boost/weak_ptr.hpp>
|
||||
#include <boost/intrusive_ptr.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
|
@ -57,26 +60,23 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#endif
|
||||
|
||||
#include "libtorrent/buffer.hpp"
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/peer_id.hpp"
|
||||
#include "libtorrent/storage.hpp"
|
||||
#include "libtorrent/stat.hpp"
|
||||
#include "libtorrent/alert.hpp"
|
||||
#include "libtorrent/torrent_handle.hpp"
|
||||
#include "libtorrent/torrent.hpp"
|
||||
#include "libtorrent/peer_request.hpp"
|
||||
#include "libtorrent/piece_block_progress.hpp"
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/session.hpp"
|
||||
#include "libtorrent/bandwidth_limit.hpp"
|
||||
#include "libtorrent/policy.hpp"
|
||||
#include "libtorrent/socket_type.hpp"
|
||||
#include "libtorrent/socket_type_fwd.hpp"
|
||||
#include "libtorrent/intrusive_ptr_base.hpp"
|
||||
#include "libtorrent/assert.hpp"
|
||||
#include "libtorrent/chained_buffer.hpp"
|
||||
#include "libtorrent/disk_buffer_holder.hpp"
|
||||
#include "libtorrent/bitfield.hpp"
|
||||
#include "libtorrent/bandwidth_socket.hpp"
|
||||
#include "libtorrent/socket_type_fwd.hpp"
|
||||
|
||||
#ifdef TORRENT_STATS
|
||||
#include "libtorrent/aux_/session_impl.hpp"
|
||||
|
@ -647,7 +647,7 @@ namespace libtorrent
|
|||
boost::intrusive_ptr<peer_connection> self()
|
||||
{
|
||||
TORRENT_ASSERT(!m_in_constructor);
|
||||
return intrusive_ptr<peer_connection>(this);
|
||||
return boost::intrusive_ptr<peer_connection>(this);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -48,7 +48,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#endif
|
||||
|
||||
#include "libtorrent/peer_id.hpp"
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/session_settings.hpp"
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/assert.hpp"
|
||||
|
|
|
@ -39,6 +39,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/peer.hpp"
|
||||
#include "libtorrent/piece_picker.hpp"
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/address.hpp"
|
||||
#include "libtorrent/size_type.hpp"
|
||||
#include "libtorrent/invariant_check.hpp"
|
||||
#include "libtorrent/config.hpp"
|
||||
|
|
|
@ -34,18 +34,11 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#define TORRENT_PROXY_BASE_HPP_INCLUDED
|
||||
|
||||
#include "libtorrent/io.hpp"
|
||||
#include "libtorrent/io_service_fwd.hpp"
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/address.hpp"
|
||||
#include "libtorrent/escape_string.hpp"
|
||||
#include "libtorrent/error_code.hpp"
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/function.hpp>
|
||||
#if BOOST_VERSION < 103500
|
||||
#include <asio/read.hpp>
|
||||
#include <asio/write.hpp>
|
||||
#else
|
||||
#include <boost/asio/read.hpp>
|
||||
#include <boost/asio/write.hpp>
|
||||
#endif
|
||||
|
||||
namespace libtorrent {
|
||||
|
||||
|
@ -80,7 +73,13 @@ public:
|
|||
return m_sock.read_some(buffers, ec);
|
||||
}
|
||||
|
||||
std::size_t available(error_code& ec) const
|
||||
{ return m_sock.available(ec); }
|
||||
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
std::size_t available() const
|
||||
{ return m_sock.available(); }
|
||||
|
||||
template <class Mutable_Buffers>
|
||||
std::size_t read_some(Mutable_Buffers const& buffers)
|
||||
{
|
||||
|
|
|
@ -324,7 +324,7 @@ namespace libtorrent
|
|||
|
||||
// if this is set, this IP will be reported do the
|
||||
// tracker in the ip= parameter.
|
||||
address announce_ip;
|
||||
std::string announce_ip;
|
||||
|
||||
// the num want sent to trackers
|
||||
int num_want;
|
||||
|
|
|
@ -50,13 +50,11 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#if BOOST_VERSION < 103500
|
||||
#include <asio/ip/tcp.hpp>
|
||||
#include <asio/ip/udp.hpp>
|
||||
#include <asio/io_service.hpp>
|
||||
#include <asio/write.hpp>
|
||||
#include <asio/read.hpp>
|
||||
#else
|
||||
#include <boost/asio/ip/tcp.hpp>
|
||||
#include <boost/asio/ip/udp.hpp>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/write.hpp>
|
||||
#include <boost/asio/read.hpp>
|
||||
#endif
|
||||
|
@ -79,12 +77,8 @@ namespace libtorrent
|
|||
using ::asio::async_read;
|
||||
|
||||
typedef ::asio::ip::tcp::socket stream_socket;
|
||||
typedef ::asio::ip::address address;
|
||||
typedef ::asio::ip::address_v4 address_v4;
|
||||
typedef ::asio::ip::address_v6 address_v6;
|
||||
typedef ::asio::ip::udp::socket datagram_socket;
|
||||
typedef ::asio::ip::tcp::acceptor socket_acceptor;
|
||||
typedef ::asio::io_service io_service;
|
||||
#else
|
||||
using boost::asio::ip::tcp;
|
||||
using boost::asio::ip::udp;
|
||||
|
@ -92,12 +86,8 @@ namespace libtorrent
|
|||
using boost::asio::async_read;
|
||||
|
||||
typedef boost::asio::ip::tcp::socket stream_socket;
|
||||
typedef boost::asio::ip::address address;
|
||||
typedef boost::asio::ip::address_v4 address_v4;
|
||||
typedef boost::asio::ip::address_v6 address_v6;
|
||||
typedef boost::asio::ip::udp::socket datagram_socket;
|
||||
typedef boost::asio::ip::tcp::acceptor socket_acceptor;
|
||||
typedef boost::asio::io_service io_service;
|
||||
|
||||
namespace asio = boost::asio;
|
||||
#endif
|
||||
|
|
|
@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#define TORRENT_SOCKET_IO_HPP_INCLUDED
|
||||
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/address.hpp"
|
||||
#include "libtorrent/io.hpp"
|
||||
#include "libtorrent/error_code.hpp"
|
||||
#include "libtorrent/lazy_entry.hpp"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2007, Arvid Norberg
|
||||
Copyright (c) 2009, Arvid Norberg
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
@ -33,21 +33,169 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef TORRENT_SOCKET_TYPE
|
||||
#define TORRENT_SOCKET_TYPE
|
||||
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/socks5_stream.hpp"
|
||||
#include "libtorrent/http_stream.hpp"
|
||||
#include "libtorrent/i2p_stream.hpp"
|
||||
#include "libtorrent/variant_stream.hpp"
|
||||
#include "libtorrent/io_service.hpp"
|
||||
#include "libtorrent/max.hpp"
|
||||
#include "libtorrent/assert.hpp"
|
||||
|
||||
#define TORRENT_SOCKTYPE_FORWARD(x) \
|
||||
switch (m_type) { \
|
||||
case socket_type_int_impl<stream_socket>::value: \
|
||||
get<stream_socket>()->x; break; \
|
||||
case socket_type_int_impl<socks5_stream>::value: \
|
||||
get<socks5_stream>()->x; break; \
|
||||
case socket_type_int_impl<http_stream>::value: \
|
||||
get<http_stream>()->x; break; \
|
||||
case socket_type_int_impl<i2p_stream>::value: \
|
||||
get<i2p_stream>()->x; break; \
|
||||
default: TORRENT_ASSERT(false); \
|
||||
}
|
||||
|
||||
#define TORRENT_SOCKTYPE_FORWARD_RET(x, def) \
|
||||
switch (m_type) { \
|
||||
case socket_type_int_impl<stream_socket>::value: \
|
||||
return get<stream_socket>()->x; \
|
||||
case socket_type_int_impl<socks5_stream>::value: \
|
||||
return get<socks5_stream>()->x; \
|
||||
case socket_type_int_impl<http_stream>::value: \
|
||||
return get<http_stream>()->x; \
|
||||
case socket_type_int_impl<i2p_stream>::value: \
|
||||
return get<i2p_stream>()->x; \
|
||||
default: TORRENT_ASSERT(false); return def; \
|
||||
}
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
typedef variant_stream<
|
||||
stream_socket
|
||||
, socks5_stream
|
||||
, http_stream
|
||||
|
||||
template <class S>
|
||||
struct socket_type_int_impl
|
||||
{ enum { value = 0 }; };
|
||||
|
||||
template <>
|
||||
struct socket_type_int_impl<stream_socket>
|
||||
{ enum { value = 1 }; };
|
||||
|
||||
template <>
|
||||
struct socket_type_int_impl<socks5_stream>
|
||||
{ enum { value = 2 }; };
|
||||
|
||||
template <>
|
||||
struct socket_type_int_impl<http_stream>
|
||||
{ enum { value = 3 }; };
|
||||
|
||||
#if TORRENT_USE_I2P
|
||||
, i2p_stream
|
||||
template <>
|
||||
struct socket_type_int_impl<i2p_stream>
|
||||
{ enum { value = 4 }; };
|
||||
#endif
|
||||
> socket_type;
|
||||
|
||||
struct socket_type
|
||||
{
|
||||
typedef stream_socket::lowest_layer_type lowest_layer_type;
|
||||
typedef stream_socket::endpoint_type endpoint_type;
|
||||
typedef stream_socket::protocol_type protocol_type;
|
||||
|
||||
explicit socket_type(io_service& ios): m_io_service(ios), m_type(0) {}
|
||||
~socket_type();
|
||||
|
||||
lowest_layer_type& lowest_layer();
|
||||
io_service& get_io_service() const;
|
||||
bool is_open() const;
|
||||
|
||||
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
void open(protocol_type const& p);
|
||||
void close();
|
||||
endpoint_type local_endpoint() const;
|
||||
endpoint_type remote_endpoint() const;
|
||||
void bind(endpoint_type const& endpoint);
|
||||
std::size_t available() const;
|
||||
#endif
|
||||
|
||||
void open(protocol_type const& p, error_code& ec);
|
||||
void close(error_code& ec);
|
||||
endpoint_type local_endpoint(error_code& ec) const;
|
||||
endpoint_type remote_endpoint(error_code& ec) const;
|
||||
void bind(endpoint_type const& endpoint, error_code& ec);
|
||||
std::size_t available(error_code& ec) const;
|
||||
|
||||
|
||||
template <class Mutable_Buffers>
|
||||
std::size_t read_some(Mutable_Buffers const& buffers, error_code& ec)
|
||||
{ TORRENT_SOCKTYPE_FORWARD_RET(read_some(buffers, ec), 0) }
|
||||
|
||||
template <class Mutable_Buffers, class Handler>
|
||||
void async_read_some(Mutable_Buffers const& buffers, Handler const& handler)
|
||||
{ TORRENT_SOCKTYPE_FORWARD(async_read_some(buffers, handler)) }
|
||||
|
||||
template <class Const_Buffers, class Handler>
|
||||
void async_write_some(Const_Buffers const& buffers, Handler const& handler)
|
||||
{ TORRENT_SOCKTYPE_FORWARD(async_write_some(buffers, handler)) }
|
||||
|
||||
template <class Handler>
|
||||
void async_connect(endpoint_type const& endpoint, Handler const& handler)
|
||||
{ TORRENT_SOCKTYPE_FORWARD(async_connect(endpoint, handler)) }
|
||||
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
template <class IO_Control_Command>
|
||||
void io_control(IO_Control_Command& ioc)
|
||||
{ TORRENT_SOCKTYPE_FORWARD(io_control(ioc)) }
|
||||
|
||||
template <class Mutable_Buffers>
|
||||
std::size_t read_some(Mutable_Buffers const& buffers)
|
||||
{ TORRENT_SOCKTYPE_FORWARD_RET(read_some(buffers), 0) }
|
||||
#endif
|
||||
|
||||
template <class IO_Control_Command>
|
||||
void io_control(IO_Control_Command& ioc, error_code& ec)
|
||||
{ TORRENT_SOCKTYPE_FORWARD(io_control(ioc, ec)) }
|
||||
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
template <class SettableSocketOption>
|
||||
void set_option(SettableSocketOption const& opt)
|
||||
{ TORRENT_SOCKTYPE_FORWARD(set_option(opt)) }
|
||||
#endif
|
||||
|
||||
template <class SettableSocketOption>
|
||||
error_code set_option(SettableSocketOption const& opt, error_code& ec)
|
||||
{ TORRENT_SOCKTYPE_FORWARD_RET(set_option(opt, ec), ec) }
|
||||
|
||||
template <class S>
|
||||
void instantiate(io_service& ios)
|
||||
{
|
||||
TORRENT_ASSERT(&ios == &m_io_service);
|
||||
construct(socket_type_int_impl<S>::value);
|
||||
}
|
||||
|
||||
template <class S> S* get()
|
||||
{
|
||||
if (m_type != socket_type_int_impl<S>::value) return 0;
|
||||
return (S*)m_data;
|
||||
}
|
||||
|
||||
template <class S> S const* get() const
|
||||
{
|
||||
if (m_type != socket_type_int_impl<S>::value) return 0;
|
||||
return (S const*)m_data;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void destruct();
|
||||
void construct(int type);
|
||||
|
||||
io_service& m_io_service;
|
||||
int m_type;
|
||||
#if TORRENT_USE_I2P
|
||||
enum { storage_size = max4<sizeof(stream_socket), sizeof(socks5_stream), sizeof(http_stream), sizeof(i2p_stream)>::value };
|
||||
#else
|
||||
enum { storage_size = max3<sizeof(stream_socket), sizeof(socks5_stream), sizeof(http_stream)>::value };
|
||||
#endif
|
||||
size_type m_data[(storage_size + sizeof(size_type) - 1) / sizeof(size_type)];
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2009, Arvid Norberg
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the author nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef TORRENT_SOCKET_TYPE_FWD_HPP
|
||||
#define TORRENT_SOCKET_TYPE_FWD_HPP
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
struct socket_type;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -33,6 +33,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef TORRENT_SOCKS5_STREAM_HPP_INCLUDED
|
||||
#define TORRENT_SOCKS5_STREAM_HPP_INCLUDED
|
||||
|
||||
#include <boost/function/function1.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include "libtorrent/proxy_base.hpp"
|
||||
|
||||
namespace libtorrent {
|
||||
|
|
|
@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#define TORRENT_SSL_STREAM_HPP_INCLUDED
|
||||
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include <boost/bind.hpp>
|
||||
#if BOOST_VERSION < 103500
|
||||
#include <asio/ssl.hpp>
|
||||
#else
|
||||
|
|
|
@ -41,9 +41,10 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#pragma warning(push, 1)
|
||||
#endif
|
||||
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/function/function2.hpp>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/intrusive_ptr.hpp>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
@ -60,26 +61,15 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/file.hpp"
|
||||
#include "libtorrent/disk_buffer_holder.hpp"
|
||||
#include "libtorrent/thread.hpp"
|
||||
#include "libtorrent/storage_defs.hpp"
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
namespace aux
|
||||
{
|
||||
struct piece_checker_data;
|
||||
}
|
||||
|
||||
class session;
|
||||
struct file_pool;
|
||||
struct disk_io_job;
|
||||
struct disk_buffer_pool;
|
||||
|
||||
enum storage_mode_t
|
||||
{
|
||||
storage_mode_allocate = 0,
|
||||
storage_mode_sparse,
|
||||
storage_mode_compact
|
||||
};
|
||||
|
||||
TORRENT_EXPORT std::vector<std::pair<size_type, std::time_t> > get_filesizes(
|
||||
file_storage const& t
|
||||
, std::string const& p);
|
||||
|
@ -190,15 +180,6 @@ namespace libtorrent
|
|||
session_settings* m_settings;
|
||||
};
|
||||
|
||||
typedef storage_interface* (*storage_constructor_type)(
|
||||
file_storage const&, file_storage const*, std::string const&, file_pool&);
|
||||
|
||||
TORRENT_EXPORT storage_interface* default_storage_constructor(
|
||||
file_storage const&, file_storage const* mapped, std::string const&, file_pool&);
|
||||
|
||||
TORRENT_EXPORT storage_interface* disabled_storage_constructor(
|
||||
file_storage const&, file_storage const* mapped, std::string const&, file_pool&);
|
||||
|
||||
struct disk_io_thread;
|
||||
|
||||
class TORRENT_EXPORT piece_manager
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2003, Arvid Norberg
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the author nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef TORRENT_STORAGE_DEFS_HPP_INCLUDE
|
||||
#define TORRENT_STORAGE_DEFS_HPP_INCLUDE
|
||||
|
||||
#include "libtorrent/config.hpp"
|
||||
#include <string>
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
struct storage_interface;
|
||||
struct file_storage;
|
||||
struct file_pool;
|
||||
|
||||
enum storage_mode_t
|
||||
{
|
||||
storage_mode_allocate = 0,
|
||||
storage_mode_sparse,
|
||||
storage_mode_compact
|
||||
};
|
||||
|
||||
typedef storage_interface* (*storage_constructor_type)(
|
||||
file_storage const&, file_storage const*, std::string const&, file_pool&);
|
||||
|
||||
TORRENT_EXPORT storage_interface* default_storage_constructor(
|
||||
file_storage const&, file_storage const* mapped, std::string const&, file_pool&);
|
||||
|
||||
TORRENT_EXPORT storage_interface* disabled_storage_constructor(
|
||||
file_storage const&, file_storage const* mapped, std::string const&, file_pool&);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -41,9 +41,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
inline char const* time_now_string()
|
||||
|
@ -60,7 +57,9 @@ namespace libtorrent
|
|||
|
||||
#if defined TORRENT_USE_BOOST_DATE_TIME
|
||||
|
||||
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
||||
#include <boost/date_time/posix_time/posix_time_duration.hpp>
|
||||
#include <boost/date_time/posix_time/ptime.hpp>
|
||||
#include <boost/date_time/microsec_time_clock.hpp>
|
||||
#include "libtorrent/assert.hpp"
|
||||
|
||||
namespace libtorrent
|
||||
|
@ -68,7 +67,7 @@ namespace libtorrent
|
|||
typedef boost::posix_time::ptime ptime;
|
||||
typedef boost::posix_time::time_duration time_duration;
|
||||
inline ptime time_now_hires()
|
||||
{ return boost::posix_time::microsec_clock::universal_time(); }
|
||||
{ return boost::date_time::microsec_clock<ptime>::universal_time(); }
|
||||
inline ptime min_time()
|
||||
{ return boost::posix_time::ptime(boost::posix_time::min_date_time); }
|
||||
inline ptime max_time()
|
||||
|
@ -90,6 +89,7 @@ namespace libtorrent
|
|||
|
||||
#else // TORRENT_USE_BOOST_DATE_TIME
|
||||
|
||||
#include <limits>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include "libtorrent/assert.hpp"
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/entry.hpp"
|
||||
#include "libtorrent/torrent_info.hpp"
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/address.hpp"
|
||||
#include "libtorrent/policy.hpp"
|
||||
#include "libtorrent/tracker_manager.hpp"
|
||||
#include "libtorrent/stat.hpp"
|
||||
|
@ -65,7 +66,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/escape_string.hpp"
|
||||
#include "libtorrent/bandwidth_limit.hpp"
|
||||
#include "libtorrent/bandwidth_queue_entry.hpp"
|
||||
#include "libtorrent/storage.hpp"
|
||||
#include "libtorrent/storage_defs.hpp"
|
||||
#include "libtorrent/hasher.hpp"
|
||||
#include "libtorrent/assert.hpp"
|
||||
#include "libtorrent/bitfield.hpp"
|
||||
|
@ -84,6 +85,7 @@ namespace libtorrent
|
|||
struct announce_entry;
|
||||
struct tracker_request;
|
||||
struct add_torrent_params;
|
||||
struct storage_interface;
|
||||
|
||||
namespace aux
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#pragma warning(push, 1)
|
||||
#endif
|
||||
|
||||
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
||||
#include <boost/date_time/posix_time/posix_time_duration.hpp>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
|
@ -53,6 +53,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/time.hpp"
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/storage.hpp"
|
||||
#include "libtorrent/address.hpp"
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
|
|
@ -43,17 +43,17 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/shared_array.hpp>
|
||||
#include <boost/date_time/posix_time/ptime.hpp>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/entry.hpp"
|
||||
#include "libtorrent/lazy_entry.hpp"
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/peer_id.hpp"
|
||||
#include "libtorrent/size_type.hpp"
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/time.hpp"
|
||||
#include "libtorrent/intrusive_ptr_base.hpp"
|
||||
#include "libtorrent/assert.hpp"
|
||||
|
@ -62,7 +62,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
namespace libtorrent
|
||||
{
|
||||
namespace pt = boost::posix_time;
|
||||
namespace gr = boost::gregorian;
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
|
@ -52,12 +52,12 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/entry.hpp"
|
||||
#include "libtorrent/session_settings.hpp"
|
||||
#include "libtorrent/peer_id.hpp"
|
||||
#include "libtorrent/peer.hpp"
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/address.hpp"
|
||||
#include "libtorrent/peer_id.hpp"
|
||||
#include "libtorrent/peer.hpp" // peer_entry
|
||||
#include "libtorrent/session_settings.hpp" // proxy_settings
|
||||
#include "libtorrent/deadline_timer.hpp"
|
||||
#include "libtorrent/connection_queue.hpp"
|
||||
#include "libtorrent/intrusive_ptr_base.hpp"
|
||||
|
|
|
@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#define TORRENT_UDP_SOCKET_HPP_INCLUDED
|
||||
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/io_service.hpp"
|
||||
#include "libtorrent/error_code.hpp"
|
||||
#include "libtorrent/session_settings.hpp"
|
||||
#include "libtorrent/buffer.hpp"
|
||||
|
@ -41,7 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/deadline_timer.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/function/function4.hpp>
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
|
|
@ -42,7 +42,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/thread.hpp"
|
||||
#include "libtorrent/deadline_timer.hpp"
|
||||
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/function/function1.hpp>
|
||||
#include <boost/function/function3.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <set>
|
||||
|
|
|
@ -39,8 +39,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <deque>
|
||||
#include <string>
|
||||
|
||||
#include "libtorrent/debug.hpp"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push, 1)
|
||||
#endif
|
||||
|
@ -56,20 +54,11 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include "libtorrent/buffer.hpp"
|
||||
#include "libtorrent/peer_connection.hpp"
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/peer_id.hpp"
|
||||
#include "libtorrent/storage.hpp"
|
||||
#include "libtorrent/stat.hpp"
|
||||
#include "libtorrent/alert.hpp"
|
||||
#include "libtorrent/torrent_handle.hpp"
|
||||
#include "libtorrent/torrent.hpp"
|
||||
#include "libtorrent/peer_request.hpp"
|
||||
#include "libtorrent/piece_block_progress.hpp"
|
||||
#include "libtorrent/config.hpp"
|
||||
// parse_url
|
||||
#include "libtorrent/tracker_manager.hpp"
|
||||
#include "libtorrent/peer_connection.hpp"
|
||||
#include "libtorrent/disk_buffer_holder.hpp"
|
||||
#include "libtorrent/torrent.hpp"
|
||||
#include "libtorrent/piece_block_progress.hpp"
|
||||
#include "libtorrent/http_parser.hpp"
|
||||
|
||||
namespace libtorrent
|
||||
|
|
|
@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/pch.hpp"
|
||||
|
||||
#include "libtorrent/alert.hpp"
|
||||
#include <boost/function.hpp>
|
||||
#include "libtorrent/io_service.hpp"
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
namespace libtorrent {
|
||||
|
|
|
@ -33,8 +33,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <boost/bind.hpp>
|
||||
#include "libtorrent/invariant_check.hpp"
|
||||
#include "libtorrent/connection_queue.hpp"
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/io_service.hpp"
|
||||
#include "libtorrent/error_code.hpp"
|
||||
#include "libtorrent/error.hpp"
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
@ -257,7 +258,7 @@ namespace libtorrent
|
|||
function_guard guard_(m_in_timeout_function);
|
||||
#endif
|
||||
|
||||
TORRENT_ASSERT(!e || e == asio::error::operation_aborted);
|
||||
TORRENT_ASSERT(!e || e == error::operation_aborted);
|
||||
if (e) return;
|
||||
|
||||
ptime next_expire = max_time();
|
||||
|
|
|
@ -40,7 +40,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/alloca.hpp"
|
||||
#include "libtorrent/invariant_check.hpp"
|
||||
#include "libtorrent/error_code.hpp"
|
||||
#include "libtorrent/error.hpp"
|
||||
#include <boost/scoped_array.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#ifdef TORRENT_DISK_STATS
|
||||
#include "libtorrent/time.hpp"
|
||||
|
@ -274,7 +276,7 @@ namespace libtorrent
|
|||
// ------- disk_io_thread ------
|
||||
|
||||
|
||||
disk_io_thread::disk_io_thread(asio::io_service& ios
|
||||
disk_io_thread::disk_io_thread(io_service& ios
|
||||
, boost::function<void()> const& queue_callback
|
||||
, int block_size)
|
||||
: disk_buffer_pool(block_size)
|
||||
|
@ -1551,7 +1553,7 @@ namespace libtorrent
|
|||
j.error = error_code(boost::system::errc::not_enough_memory
|
||||
, get_posix_category());
|
||||
#else
|
||||
j.error = asio::error::no_memory;
|
||||
j.error = error::no_memory;
|
||||
#endif
|
||||
j.str.clear();
|
||||
break;
|
||||
|
@ -1615,7 +1617,7 @@ namespace libtorrent
|
|||
j.error = error_code(boost::system::errc::not_enough_memory
|
||||
, get_posix_category());
|
||||
#else
|
||||
j.error = asio::error::no_memory;
|
||||
j.error = error::no_memory;
|
||||
#endif
|
||||
j.str.clear();
|
||||
break;
|
||||
|
|
|
@ -470,11 +470,11 @@ namespace libtorrent
|
|||
return ret;
|
||||
}
|
||||
|
||||
boost::optional<std::string> url_has_argument(
|
||||
std::string url_has_argument(
|
||||
std::string const& url, std::string argument)
|
||||
{
|
||||
size_t i = url.find('?');
|
||||
if (i == std::string::npos) return boost::optional<std::string>();
|
||||
if (i == std::string::npos) return std::string();
|
||||
++i;
|
||||
|
||||
argument += '=';
|
||||
|
@ -486,7 +486,7 @@ namespace libtorrent
|
|||
}
|
||||
argument.insert(0, "&");
|
||||
i = url.find(argument, i);
|
||||
if (i == std::string::npos) return boost::optional<std::string>();
|
||||
if (i == std::string::npos) return std::string();
|
||||
size_t pos = i + argument.size();
|
||||
return url.substr(pos, url.find('&', pos) - pos);
|
||||
}
|
||||
|
|
|
@ -172,11 +172,11 @@ namespace libtorrent
|
|||
}
|
||||
else
|
||||
#endif
|
||||
if (settings.announce_ip != address())
|
||||
if (!settings.announce_ip.empty())
|
||||
{
|
||||
error_code ec;
|
||||
std::string ip = settings.announce_ip.to_string(ec);
|
||||
if (!ec) url += "&ip=" + ip;
|
||||
if (!ec) url += "&ip=" + escape_string(
|
||||
settings.announce_ip.c_str(), settings.announce_ip.size());
|
||||
}
|
||||
|
||||
if (!tracker_req().ipv6.empty() && !i2p)
|
||||
|
|
|
@ -40,7 +40,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <numeric>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
#include "libtorrent/kademlia/node.hpp"
|
||||
#include "libtorrent/kademlia/node_id.hpp"
|
||||
|
@ -182,21 +181,21 @@ namespace libtorrent { namespace dht
|
|||
TORRENT_DEFINE_LOG(dht_tracker)
|
||||
#endif
|
||||
|
||||
boost::optional<node_id> extract_node_id(lazy_entry const* e)
|
||||
node_id extract_node_id(lazy_entry const* e)
|
||||
{
|
||||
if (e == 0 || e->type() != lazy_entry::dict_t) return boost::optional<node_id>();
|
||||
if (e == 0 || e->type() != lazy_entry::dict_t) return (node_id::min)();
|
||||
lazy_entry const* nid = e->dict_find_string("node-id");
|
||||
if (nid == 0 || nid->string_length() != 20) return boost::optional<node_id>();
|
||||
return boost::optional<node_id>(node_id(nid->string_ptr()));
|
||||
if (nid == 0 || nid->string_length() != 20) return (node_id::min)();
|
||||
return node_id(node_id(nid->string_ptr()));
|
||||
}
|
||||
|
||||
boost::optional<node_id> extract_node_id(entry const* e)
|
||||
node_id extract_node_id(entry const* e)
|
||||
{
|
||||
if (e == 0 || e->type() != entry::dictionary_t) return boost::optional<node_id>();
|
||||
if (e == 0 || e->type() != entry::dictionary_t) return (node_id::min)();
|
||||
entry const* nid = e->find_key("node-id");
|
||||
if (nid == 0 || nid->type() != entry::string_t || nid->string().length() != 20)
|
||||
return boost::optional<node_id>();
|
||||
return boost::optional<node_id>(node_id(nid->string().c_str()));
|
||||
return (node_id::min)();
|
||||
return node_id(node_id(nid->string().c_str()));
|
||||
}
|
||||
|
||||
bool send_callback(void* userdata, entry const& e, udp::endpoint const& addr, int flags)
|
||||
|
|
|
@ -34,13 +34,10 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <utility>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/iterator_adaptors.hpp>
|
||||
#include <boost/function/function1.hpp>
|
||||
|
||||
#include "libtorrent/io.hpp"
|
||||
#include "libtorrent/hasher.hpp"
|
||||
#include "libtorrent/random_sample.hpp"
|
||||
#include "libtorrent/alert_types.hpp"
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/aux_/session_impl.hpp"
|
||||
|
@ -185,10 +182,10 @@ void nop() {}
|
|||
node_impl::node_impl(libtorrent::aux::session_impl& ses
|
||||
, bool (*f)(void*, entry const&, udp::endpoint const&, int)
|
||||
, dht_settings const& settings
|
||||
, boost::optional<node_id> nid
|
||||
, node_id nid
|
||||
, void* userdata)
|
||||
: m_settings(settings)
|
||||
, m_id(nid ? *nid : generate_id())
|
||||
, m_id(nid == (node_id::min)()? nid : generate_id())
|
||||
, m_table(m_id, 8, settings)
|
||||
, m_rpc(m_id, m_table, f, userdata)
|
||||
, m_last_tracker_tick(time_now())
|
||||
|
|
|
@ -48,12 +48,19 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/extensions.hpp"
|
||||
#include "libtorrent/entry.hpp"
|
||||
#include "libtorrent/peer_request.hpp"
|
||||
#include "libtorrent/peer_connection.hpp"
|
||||
|
||||
#if TORRENT_USE_IOSTREAM
|
||||
|
||||
#include <fstream>
|
||||
#include "libtorrent/file.hpp"
|
||||
#include "libtorrent/time.hpp"
|
||||
#include "libtorrent/lazy_entry.hpp"
|
||||
#include "libtorrent/peer_connection.hpp"
|
||||
|
||||
namespace libtorrent {
|
||||
|
||||
struct peer_connection;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
|
|
|
@ -106,19 +106,19 @@ namespace libtorrent
|
|||
std::string tracker;
|
||||
|
||||
error_code ec;
|
||||
boost::optional<std::string> display_name = url_has_argument(uri, "dn");
|
||||
if (display_name) name = unescape_string(display_name->c_str(), ec);
|
||||
boost::optional<std::string> tracker_string = url_has_argument(uri, "tr");
|
||||
if (tracker_string) tracker = unescape_string(tracker_string->c_str(), ec);
|
||||
std::string display_name = url_has_argument(uri, "dn");
|
||||
if (!display_name.empty()) name = unescape_string(display_name.c_str(), ec);
|
||||
std::string tracker_string = url_has_argument(uri, "tr");
|
||||
if (!tracker_string.empty()) tracker = unescape_string(tracker_string.c_str(), ec);
|
||||
|
||||
boost::optional<std::string> btih = url_has_argument(uri, "xt");
|
||||
if (!btih) return torrent_handle();
|
||||
std::string btih = url_has_argument(uri, "xt");
|
||||
if (btih.empty()) return torrent_handle();
|
||||
|
||||
if (btih->compare(0, 9, "urn:btih:") != 0) return torrent_handle();
|
||||
if (btih.compare(0, 9, "urn:btih:") != 0) return torrent_handle();
|
||||
|
||||
sha1_hash info_hash;
|
||||
if (btih->size() == 40 + 9) from_hex(&(*btih)[9], 40, (char*)&info_hash[0]);
|
||||
else info_hash.assign(base32decode(btih->substr(9)));
|
||||
if (btih.size() == 40 + 9) from_hex(&btih[9], 40, (char*)&info_hash[0]);
|
||||
else info_hash.assign(base32decode(btih.substr(9)));
|
||||
|
||||
return ses.add_torrent(tracker.empty() ? 0 : tracker.c_str(), info_hash
|
||||
, name.empty() ? 0 : name.c_str(), save_path, entry()
|
||||
|
@ -142,27 +142,27 @@ namespace libtorrent
|
|||
std::string tracker;
|
||||
|
||||
error_code e;
|
||||
boost::optional<std::string> display_name = url_has_argument(uri, "dn");
|
||||
if (display_name) name = unescape_string(display_name->c_str(), e);
|
||||
boost::optional<std::string> tracker_string = url_has_argument(uri, "tr");
|
||||
if (tracker_string) tracker = unescape_string(tracker_string->c_str(), e);
|
||||
std::string display_name = url_has_argument(uri, "dn");
|
||||
if (!display_name.empty()) name = unescape_string(display_name.c_str(), e);
|
||||
std::string tracker_string = url_has_argument(uri, "tr");
|
||||
if (!tracker_string.empty()) tracker = unescape_string(tracker_string.c_str(), e);
|
||||
|
||||
boost::optional<std::string> btih = url_has_argument(uri, "xt");
|
||||
if (!btih)
|
||||
std::string btih = url_has_argument(uri, "xt");
|
||||
if (btih.empty())
|
||||
{
|
||||
ec = error_code(errors::missing_info_hash_in_uri, libtorrent_category);
|
||||
return torrent_handle();
|
||||
}
|
||||
|
||||
if (btih->compare(0, 9, "urn:btih:") != 0)
|
||||
if (btih.compare(0, 9, "urn:btih:") != 0)
|
||||
{
|
||||
ec = error_code(errors::missing_info_hash_in_uri, libtorrent_category);
|
||||
return torrent_handle();
|
||||
}
|
||||
|
||||
sha1_hash info_hash;
|
||||
if (btih->size() == 40 + 9) from_hex(&(*btih)[9], 40, (char*)&info_hash[0]);
|
||||
else info_hash.assign(base32decode(btih->substr(9)));
|
||||
if (btih.size() == 40 + 9) from_hex(&btih[9], 40, (char*)&info_hash[0]);
|
||||
else info_hash.assign(base32decode(btih.substr(9)));
|
||||
|
||||
if (!tracker.empty()) p.tracker_url = tracker.c_str();
|
||||
p.info_hash = info_hash;
|
||||
|
|
|
@ -46,6 +46,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/assert.hpp"
|
||||
#include "libtorrent/enum_net.hpp"
|
||||
#include "libtorrent/socket_io.hpp"
|
||||
#include "libtorrent/io_service.hpp"
|
||||
|
||||
using boost::bind;
|
||||
using namespace libtorrent;
|
||||
|
|
|
@ -51,6 +51,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/socket_type.hpp"
|
||||
#include "libtorrent/assert.hpp"
|
||||
#include "libtorrent/broadcast_socket.hpp"
|
||||
#include "libtorrent/torrent.hpp"
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
#include <set>
|
||||
|
|
|
@ -59,11 +59,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/bt_peer_connection.hpp"
|
||||
#endif
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
class peer_connection;
|
||||
}
|
||||
|
||||
using boost::bind;
|
||||
|
||||
namespace
|
||||
|
|
|
@ -33,7 +33,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/pch.hpp"
|
||||
|
||||
#include <ctime>
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
#include <cctype>
|
||||
|
|
|
@ -33,7 +33,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/pch.hpp"
|
||||
|
||||
#include <ctime>
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
#include <cctype>
|
||||
|
|
|
@ -49,18 +49,18 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <numeric>
|
||||
#include <cstdio>
|
||||
|
||||
#include "libtorrent/peer_connection.hpp"
|
||||
#include "libtorrent/bt_peer_connection.hpp"
|
||||
#include "libtorrent/hasher.hpp"
|
||||
#include "libtorrent/bencode.hpp"
|
||||
#include "libtorrent/torrent.hpp"
|
||||
#include "libtorrent/extensions.hpp"
|
||||
#include "libtorrent/extensions/smart_ban.hpp"
|
||||
#include "libtorrent/alert_types.hpp"
|
||||
#include "libtorrent/disk_io_thread.hpp"
|
||||
#include "libtorrent/aux_/session_impl.hpp"
|
||||
|
||||
namespace libtorrent { namespace
|
||||
namespace libtorrent {
|
||||
|
||||
struct torrent;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct smart_ban_plugin : torrent_plugin, boost::enable_shared_from_this<smart_ban_plugin>
|
||||
|
|
|
@ -35,6 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/escape_string.hpp"
|
||||
#include "libtorrent/error_code.hpp"
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/address.hpp"
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
|
|
@ -0,0 +1,147 @@
|
|||
/*
|
||||
|
||||
Copyright (c) 2009, Arvid Norberg
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the author nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "libtorrent/socket_type.hpp"
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
||||
void socket_type::destruct()
|
||||
{
|
||||
switch (m_type)
|
||||
{
|
||||
case 0: break;
|
||||
case socket_type_int_impl<stream_socket>::value:
|
||||
get<stream_socket>()->~stream_socket();
|
||||
break;
|
||||
case socket_type_int_impl<socks5_stream>::value:
|
||||
get<socks5_stream>()->~socks5_stream();
|
||||
break;
|
||||
case socket_type_int_impl<http_stream>::value:
|
||||
get<http_stream>()->~http_stream();
|
||||
break;
|
||||
#if TORRENT_USE_I2P
|
||||
case socket_type_int_impl<i2p_stream>::value:
|
||||
get<i2p_stream>()->~i2p_stream();
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
m_type = 0;
|
||||
}
|
||||
|
||||
void socket_type::construct(int type)
|
||||
{
|
||||
destruct();
|
||||
switch (type)
|
||||
{
|
||||
case 0: break;
|
||||
case socket_type_int_impl<stream_socket>::value:
|
||||
new ((stream_socket*)m_data) stream_socket(m_io_service);
|
||||
break;
|
||||
case socket_type_int_impl<socks5_stream>::value:
|
||||
new ((socks5_stream*)m_data) socks5_stream(m_io_service);
|
||||
break;
|
||||
case socket_type_int_impl<http_stream>::value:
|
||||
new ((http_stream*)m_data) http_stream(m_io_service);
|
||||
break;
|
||||
#if TORRENT_USE_I2P
|
||||
case socket_type_int_impl<i2p_stream>::value:
|
||||
new ((i2p_stream*)m_data) i2p_stream(m_io_service);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
m_type = type;
|
||||
}
|
||||
|
||||
io_service& socket_type::get_io_service() const
|
||||
{ return m_io_service; }
|
||||
|
||||
socket_type::~socket_type()
|
||||
{ destruct(); }
|
||||
|
||||
bool socket_type::is_open() const
|
||||
{
|
||||
if (m_type == 0) return false;
|
||||
TORRENT_SOCKTYPE_FORWARD_RET(is_open(), false)
|
||||
}
|
||||
|
||||
socket_type::lowest_layer_type& socket_type::lowest_layer()
|
||||
{ TORRENT_SOCKTYPE_FORWARD_RET(lowest_layer(), *((lowest_layer_type*)m_data)) }
|
||||
|
||||
|
||||
void socket_type::open(protocol_type const& p, error_code& ec)
|
||||
{ TORRENT_SOCKTYPE_FORWARD(open(p, ec)) }
|
||||
|
||||
void socket_type::close(error_code& ec)
|
||||
{
|
||||
if (m_type == 0) return;
|
||||
TORRENT_SOCKTYPE_FORWARD(close(ec))
|
||||
}
|
||||
|
||||
socket_type::endpoint_type socket_type::local_endpoint(error_code& ec) const
|
||||
{ TORRENT_SOCKTYPE_FORWARD_RET(local_endpoint(ec), socket_type::endpoint_type()) }
|
||||
|
||||
socket_type::endpoint_type socket_type::remote_endpoint(error_code& ec) const
|
||||
{ TORRENT_SOCKTYPE_FORWARD_RET(remote_endpoint(ec), socket_type::endpoint_type()) }
|
||||
|
||||
void socket_type::bind(endpoint_type const& endpoint, error_code& ec)
|
||||
{ TORRENT_SOCKTYPE_FORWARD(bind(endpoint, ec)) }
|
||||
|
||||
std::size_t socket_type::available(error_code& ec) const
|
||||
{ TORRENT_SOCKTYPE_FORWARD_RET(available(ec), 0) }
|
||||
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
void socket_type::open(protocol_type const& p)
|
||||
{ TORRENT_SOCKTYPE_FORWARD(open(p)) }
|
||||
|
||||
void socket_type::close()
|
||||
{
|
||||
if (m_type == 0) return;
|
||||
TORRENT_SOCKTYPE_FORWARD(close())
|
||||
}
|
||||
|
||||
socket_type::endpoint_type socket_type::local_endpoint() const
|
||||
{ TORRENT_SOCKTYPE_FORWARD_RET(local_endpoint(), socket_type::endpoint_type()) }
|
||||
|
||||
socket_type::endpoint_type socket_type::remote_endpoint() const
|
||||
{ TORRENT_SOCKTYPE_FORWARD_RET(remote_endpoint(), socket_type::endpoint_type()) }
|
||||
|
||||
void socket_type::bind(endpoint_type const& endpoint)
|
||||
{ TORRENT_SOCKTYPE_FORWARD(bind(endpoint)) }
|
||||
|
||||
std::size_t socket_type::available() const
|
||||
{ TORRENT_SOCKTYPE_FORWARD_RET(available(), 0) }
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
@ -33,7 +33,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/pch.hpp"
|
||||
|
||||
#include <ctime>
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
#include <functional>
|
||||
|
|
|
@ -33,7 +33,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/pch.hpp"
|
||||
|
||||
#include <ctime>
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
#include <cctype>
|
||||
|
|
|
@ -48,6 +48,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#endif
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/date_time/posix_time/ptime.hpp>
|
||||
#include <boost/date_time/posix_time/posix_time_duration.hpp>
|
||||
#include <boost/date_time/time_clock.hpp>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
|
@ -568,13 +571,15 @@ namespace libtorrent
|
|||
}
|
||||
#endif
|
||||
|
||||
typedef boost::date_time::second_clock<pt::ptime> second_clock;
|
||||
|
||||
// constructor used for creating new torrents
|
||||
// will not contain any hashes, comments, creation date
|
||||
// just the necessary to use it with piece manager
|
||||
// used for torrents with no metadata
|
||||
torrent_info::torrent_info(sha1_hash const& info_hash)
|
||||
: m_info_hash(info_hash)
|
||||
, m_creation_date(pt::second_clock::universal_time())
|
||||
, m_creation_date(second_clock::universal_time())
|
||||
, m_multifile(false)
|
||||
, m_private(false)
|
||||
, m_i2p(false)
|
||||
|
|
|
@ -40,13 +40,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/tracker_manager.hpp"
|
||||
#include "libtorrent/http_tracker_connection.hpp"
|
||||
#include "libtorrent/udp_tracker_connection.hpp"
|
||||
#include "libtorrent/entry.hpp"
|
||||
#include "libtorrent/bencode.hpp"
|
||||
#include "libtorrent/torrent.hpp"
|
||||
#include "libtorrent/peer_connection.hpp"
|
||||
#include "libtorrent/aux_/session_impl.hpp"
|
||||
|
||||
using namespace libtorrent;
|
||||
using boost::tuples::make_tuple;
|
||||
using boost::tuples::tuple;
|
||||
using boost::bind;
|
||||
|
|
|
@ -528,10 +528,15 @@ namespace libtorrent
|
|||
detail::write_int64(stats ? req.uploaded : 0, out); // uploaded
|
||||
detail::write_int32(req.event, out); // event
|
||||
// ip address
|
||||
if (settings.announce_ip != address() && settings.announce_ip.is_v4())
|
||||
detail::write_uint32(settings.announce_ip.to_v4().to_ulong(), out);
|
||||
else
|
||||
detail::write_int32(0, out);
|
||||
address_v4 announce_ip;
|
||||
|
||||
if (!settings.announce_ip.empty())
|
||||
{
|
||||
error_code ec;
|
||||
address ip = address::from_string(settings.announce_ip.c_str(), ec);
|
||||
if (!ec && ip.is_v4()) announce_ip = ip.to_v4();
|
||||
}
|
||||
detail::write_uint32(announce_ip.to_ulong(), out);
|
||||
detail::write_int32(req.key, out); // key
|
||||
detail::write_int32(req.num_want, out); // num_want
|
||||
detail::write_uint16(req.listen_port, out); // port
|
||||
|
|
|
@ -634,14 +634,14 @@ int test_main()
|
|||
|
||||
// url_has_argument
|
||||
|
||||
TEST_CHECK(!url_has_argument("http://127.0.0.1/test", "test"));
|
||||
TEST_CHECK(!url_has_argument("http://127.0.0.1/test?foo=24", "bar"));
|
||||
TEST_CHECK(*url_has_argument("http://127.0.0.1/test?foo=24", "foo") == "24");
|
||||
TEST_CHECK(*url_has_argument("http://127.0.0.1/test?foo=24&bar=23", "foo") == "24");
|
||||
TEST_CHECK(*url_has_argument("http://127.0.0.1/test?foo=24&bar=23", "bar") == "23");
|
||||
TEST_CHECK(*url_has_argument("http://127.0.0.1/test?foo=24&bar=23&a=e", "bar") == "23");
|
||||
TEST_CHECK(*url_has_argument("http://127.0.0.1/test?foo=24&bar=23&a=e", "a") == "e");
|
||||
TEST_CHECK(!url_has_argument("http://127.0.0.1/test?foo=24&bar=23&a=e", "b"));
|
||||
TEST_CHECK(url_has_argument("http://127.0.0.1/test", "test") == "");
|
||||
TEST_CHECK(url_has_argument("http://127.0.0.1/test?foo=24", "bar") == "");
|
||||
TEST_CHECK(url_has_argument("http://127.0.0.1/test?foo=24", "foo") == "24");
|
||||
TEST_CHECK(url_has_argument("http://127.0.0.1/test?foo=24&bar=23", "foo") == "24");
|
||||
TEST_CHECK(url_has_argument("http://127.0.0.1/test?foo=24&bar=23", "bar") == "23");
|
||||
TEST_CHECK(url_has_argument("http://127.0.0.1/test?foo=24&bar=23&a=e", "bar") == "23");
|
||||
TEST_CHECK(url_has_argument("http://127.0.0.1/test?foo=24&bar=23&a=e", "a") == "e");
|
||||
TEST_CHECK(url_has_argument("http://127.0.0.1/test?foo=24&bar=23&a=e", "b") == "");
|
||||
|
||||
// escape_string
|
||||
char const* test_string = "!@#$%^&*()-_=+/,. %?";
|
||||
|
|
|
@ -37,9 +37,11 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/bencode.hpp"
|
||||
#include "libtorrent/thread.hpp"
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#include "test.hpp"
|
||||
#include "setup_transfer.hpp"
|
||||
#include <fstream>
|
||||
|
||||
using namespace libtorrent;
|
||||
using boost::tuples::ignore;
|
||||
|
|
Loading…
Reference in New Issue