forked from premiere/premiere-libtorrent
remove some unnecessary asio typedefs in the libtorrent namespace, just pull ip::tcp and ip::udp
This commit is contained in:
parent
09a01a777a
commit
9af8841244
|
@ -203,7 +203,7 @@ struct peer_conn
|
||||||
s.async_connect(endpoint, boost::bind(&peer_conn::on_connect, this, _1));
|
s.async_connect(endpoint, boost::bind(&peer_conn::on_connect, this, _1));
|
||||||
}
|
}
|
||||||
|
|
||||||
stream_socket s;
|
tcp::socket s;
|
||||||
char write_buf_proto[100];
|
char write_buf_proto[100];
|
||||||
boost::uint32_t write_buffer[17*1024/4];
|
boost::uint32_t write_buffer[17*1024/4];
|
||||||
boost::uint32_t buffer[17*1024/4];
|
boost::uint32_t buffer[17*1024/4];
|
||||||
|
|
|
@ -141,7 +141,7 @@ namespace libtorrent
|
||||||
bool ssl;
|
bool ssl;
|
||||||
|
|
||||||
// the actual socket
|
// the actual socket
|
||||||
boost::shared_ptr<socket_acceptor> sock;
|
boost::shared_ptr<tcp::acceptor> sock;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace aux
|
namespace aux
|
||||||
|
@ -234,9 +234,9 @@ namespace libtorrent
|
||||||
tcp::endpoint get_ipv6_interface() const;
|
tcp::endpoint get_ipv6_interface() const;
|
||||||
tcp::endpoint get_ipv4_interface() const;
|
tcp::endpoint get_ipv4_interface() const;
|
||||||
|
|
||||||
void async_accept(boost::shared_ptr<socket_acceptor> const& listener, bool ssl);
|
void async_accept(boost::shared_ptr<tcp::acceptor> const& listener, bool ssl);
|
||||||
void on_accept_connection(boost::shared_ptr<socket_type> const& s
|
void on_accept_connection(boost::shared_ptr<socket_type> const& s
|
||||||
, boost::weak_ptr<socket_acceptor> listener, error_code const& e, bool ssl);
|
, boost::weak_ptr<tcp::acceptor> listener, error_code const& e, bool ssl);
|
||||||
void on_socks_accept(boost::shared_ptr<socket_type> const& s
|
void on_socks_accept(boost::shared_ptr<socket_type> const& s
|
||||||
, error_code const& e);
|
, error_code const& e);
|
||||||
|
|
||||||
|
|
|
@ -86,11 +86,11 @@ namespace libtorrent
|
||||||
|
|
||||||
struct socket_entry
|
struct socket_entry
|
||||||
{
|
{
|
||||||
socket_entry(boost::shared_ptr<datagram_socket> const& s)
|
socket_entry(boost::shared_ptr<udp::socket> const& s)
|
||||||
: socket(s), broadcast(false) {}
|
: socket(s), broadcast(false) {}
|
||||||
socket_entry(boost::shared_ptr<datagram_socket> const& s
|
socket_entry(boost::shared_ptr<udp::socket> const& s
|
||||||
, address_v4 const& mask): socket(s), netmask(mask), broadcast(false) {}
|
, address_v4 const& mask): socket(s), netmask(mask), broadcast(false) {}
|
||||||
boost::shared_ptr<datagram_socket> socket;
|
boost::shared_ptr<udp::socket> socket;
|
||||||
char buffer[1500];
|
char buffer[1500];
|
||||||
udp::endpoint remote;
|
udp::endpoint remote;
|
||||||
address_v4 netmask;
|
address_v4 netmask;
|
||||||
|
|
|
@ -116,7 +116,7 @@ namespace libtorrent { namespace dht
|
||||||
, udp::endpoint const&, char const* buf, int size);
|
, udp::endpoint const&, char const* buf, int size);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
boost::shared_ptr<dht_tracker> self()
|
boost::shared_ptr<dht_tracker> self()
|
||||||
{ return shared_from_this(); }
|
{ return shared_from_this(); }
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ private:
|
||||||
|
|
||||||
// the udp socket used to communicate
|
// the udp socket used to communicate
|
||||||
// with the NAT router
|
// with the NAT router
|
||||||
datagram_socket m_socket;
|
udp::socket m_socket;
|
||||||
|
|
||||||
// used to resend udp packets in case
|
// used to resend udp packets in case
|
||||||
// they time out
|
// they time out
|
||||||
|
|
|
@ -51,10 +51,10 @@ public:
|
||||||
|
|
||||||
typedef boost::function<void(error_code const&)> handler_type;
|
typedef boost::function<void(error_code const&)> handler_type;
|
||||||
|
|
||||||
typedef stream_socket next_layer_type;
|
typedef tcp::socket next_layer_type;
|
||||||
typedef stream_socket::lowest_layer_type lowest_layer_type;
|
typedef tcp::socket::lowest_layer_type lowest_layer_type;
|
||||||
typedef stream_socket::endpoint_type endpoint_type;
|
typedef tcp::socket::endpoint_type endpoint_type;
|
||||||
typedef stream_socket::protocol_type protocol_type;
|
typedef tcp::socket::protocol_type protocol_type;
|
||||||
|
|
||||||
explicit proxy_base(io_service& io_service);
|
explicit proxy_base(io_service& io_service);
|
||||||
~proxy_base();
|
~proxy_base();
|
||||||
|
@ -250,7 +250,7 @@ protected:
|
||||||
|
|
||||||
bool handle_error(error_code const& e, boost::shared_ptr<handler_type> const& h);
|
bool handle_error(error_code const& e, boost::shared_ptr<handler_type> const& h);
|
||||||
|
|
||||||
stream_socket m_sock;
|
tcp::socket m_sock;
|
||||||
std::string m_hostname;
|
std::string m_hostname;
|
||||||
int m_port;
|
int m_port;
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include "libtorrent/error_code.hpp"
|
#include "libtorrent/error_code.hpp"
|
||||||
#include "libtorrent/io_service.hpp"
|
#include "libtorrent/io_service.hpp"
|
||||||
|
#include "libtorrent/socket.hpp"
|
||||||
#include "libtorrent/resolver_interface.hpp"
|
#include "libtorrent/resolver_interface.hpp"
|
||||||
#include "libtorrent/address.hpp"
|
#include "libtorrent/address.hpp"
|
||||||
#include "libtorrent/time.hpp"
|
#include "libtorrent/time.hpp"
|
||||||
|
|
|
@ -1583,7 +1583,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
// use only plaintext encryption
|
// use only plaintext encryption
|
||||||
pe_plaintext = 1,
|
pe_plaintext = 1,
|
||||||
// use only rc4 encryption
|
// use only rc4 encryption
|
||||||
pe_rc4 = 2,
|
pe_rc4 = 2,
|
||||||
// allow both
|
// allow both
|
||||||
pe_both = 3
|
pe_both = 3
|
||||||
|
|
|
@ -69,10 +69,6 @@ namespace libtorrent
|
||||||
using boost::asio::async_write;
|
using boost::asio::async_write;
|
||||||
using boost::asio::async_read;
|
using boost::asio::async_read;
|
||||||
|
|
||||||
typedef boost::asio::ip::tcp::socket stream_socket;
|
|
||||||
typedef boost::asio::ip::udp::socket datagram_socket;
|
|
||||||
typedef boost::asio::ip::tcp::acceptor socket_acceptor;
|
|
||||||
|
|
||||||
#if TORRENT_USE_IPV6
|
#if TORRENT_USE_IPV6
|
||||||
#ifdef IPV6_V6ONLY
|
#ifdef IPV6_V6ONLY
|
||||||
struct v6only
|
struct v6only
|
||||||
|
|
|
@ -75,8 +75,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifdef TORRENT_USE_OPENSSL
|
#ifdef TORRENT_USE_OPENSSL
|
||||||
|
|
||||||
#define TORRENT_SOCKTYPE_SSL_FORWARD(x) \
|
#define TORRENT_SOCKTYPE_SSL_FORWARD(x) \
|
||||||
case socket_type_int_impl<ssl_stream<stream_socket> >::value: \
|
case socket_type_int_impl<ssl_stream<tcp::socket> >::value: \
|
||||||
get<ssl_stream<stream_socket> >()->x; break; \
|
get<ssl_stream<tcp::socket> >()->x; break; \
|
||||||
case socket_type_int_impl<ssl_stream<socks5_stream> >::value: \
|
case socket_type_int_impl<ssl_stream<socks5_stream> >::value: \
|
||||||
get<ssl_stream<socks5_stream> >()->x; break; \
|
get<ssl_stream<socks5_stream> >()->x; break; \
|
||||||
case socket_type_int_impl<ssl_stream<http_stream> >::value: \
|
case socket_type_int_impl<ssl_stream<http_stream> >::value: \
|
||||||
|
@ -85,8 +85,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
get<ssl_stream<utp_stream> >()->x; break;
|
get<ssl_stream<utp_stream> >()->x; break;
|
||||||
|
|
||||||
#define TORRENT_SOCKTYPE_SSL_FORWARD_RET(x, def) \
|
#define TORRENT_SOCKTYPE_SSL_FORWARD_RET(x, def) \
|
||||||
case socket_type_int_impl<ssl_stream<stream_socket> >::value: \
|
case socket_type_int_impl<ssl_stream<tcp::socket> >::value: \
|
||||||
return get<ssl_stream<stream_socket> >()->x; \
|
return get<ssl_stream<tcp::socket> >()->x; \
|
||||||
case socket_type_int_impl<ssl_stream<socks5_stream> >::value: \
|
case socket_type_int_impl<ssl_stream<socks5_stream> >::value: \
|
||||||
return get<ssl_stream<socks5_stream> >()->x; \
|
return get<ssl_stream<socks5_stream> >()->x; \
|
||||||
case socket_type_int_impl<ssl_stream<http_stream> >::value: \
|
case socket_type_int_impl<ssl_stream<http_stream> >::value: \
|
||||||
|
@ -103,8 +103,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#define TORRENT_SOCKTYPE_FORWARD(x) \
|
#define TORRENT_SOCKTYPE_FORWARD(x) \
|
||||||
switch (m_type) { \
|
switch (m_type) { \
|
||||||
case socket_type_int_impl<stream_socket>::value: \
|
case socket_type_int_impl<tcp::socket>::value: \
|
||||||
get<stream_socket>()->x; break; \
|
get<tcp::socket>()->x; break; \
|
||||||
case socket_type_int_impl<socks5_stream>::value: \
|
case socket_type_int_impl<socks5_stream>::value: \
|
||||||
get<socks5_stream>()->x; break; \
|
get<socks5_stream>()->x; break; \
|
||||||
case socket_type_int_impl<http_stream>::value: \
|
case socket_type_int_impl<http_stream>::value: \
|
||||||
|
@ -118,8 +118,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#define TORRENT_SOCKTYPE_FORWARD_RET(x, def) \
|
#define TORRENT_SOCKTYPE_FORWARD_RET(x, def) \
|
||||||
switch (m_type) { \
|
switch (m_type) { \
|
||||||
case socket_type_int_impl<stream_socket>::value: \
|
case socket_type_int_impl<tcp::socket>::value: \
|
||||||
return get<stream_socket>()->x; \
|
return get<tcp::socket>()->x; \
|
||||||
case socket_type_int_impl<socks5_stream>::value: \
|
case socket_type_int_impl<socks5_stream>::value: \
|
||||||
return get<socks5_stream>()->x; \
|
return get<socks5_stream>()->x; \
|
||||||
case socket_type_int_impl<http_stream>::value: \
|
case socket_type_int_impl<http_stream>::value: \
|
||||||
|
@ -139,7 +139,7 @@ namespace libtorrent
|
||||||
{ enum { value = 0 }; };
|
{ enum { value = 0 }; };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct socket_type_int_impl<stream_socket>
|
struct socket_type_int_impl<tcp::socket>
|
||||||
{ enum { value = 1 }; };
|
{ enum { value = 1 }; };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
@ -162,7 +162,7 @@ namespace libtorrent
|
||||||
|
|
||||||
#ifdef TORRENT_USE_OPENSSL
|
#ifdef TORRENT_USE_OPENSSL
|
||||||
template <>
|
template <>
|
||||||
struct socket_type_int_impl<ssl_stream<stream_socket> >
|
struct socket_type_int_impl<ssl_stream<tcp::socket> >
|
||||||
{ enum { value = 6 }; };
|
{ enum { value = 6 }; };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
@ -180,8 +180,8 @@ namespace libtorrent
|
||||||
|
|
||||||
struct TORRENT_EXTRA_EXPORT socket_type
|
struct TORRENT_EXTRA_EXPORT socket_type
|
||||||
{
|
{
|
||||||
typedef stream_socket::endpoint_type endpoint_type;
|
typedef tcp::socket::endpoint_type endpoint_type;
|
||||||
typedef stream_socket::protocol_type protocol_type;
|
typedef tcp::socket::protocol_type protocol_type;
|
||||||
|
|
||||||
explicit socket_type(io_service& ios): m_io_service(ios), m_type(0) {}
|
explicit socket_type(io_service& ios): m_io_service(ios), m_type(0) {}
|
||||||
~socket_type();
|
~socket_type();
|
||||||
|
@ -298,7 +298,7 @@ namespace libtorrent
|
||||||
io_service& m_io_service;
|
io_service& m_io_service;
|
||||||
int m_type;
|
int m_type;
|
||||||
enum { storage_size = max9<
|
enum { storage_size = max9<
|
||||||
sizeof(stream_socket)
|
sizeof(tcp::socket)
|
||||||
, sizeof(socks5_stream)
|
, sizeof(socks5_stream)
|
||||||
, sizeof(http_stream)
|
, sizeof(http_stream)
|
||||||
, sizeof(utp_stream)
|
, sizeof(utp_stream)
|
||||||
|
@ -308,7 +308,7 @@ namespace libtorrent
|
||||||
, 0
|
, 0
|
||||||
#endif
|
#endif
|
||||||
#ifdef TORRENT_USE_OPENSSL
|
#ifdef TORRENT_USE_OPENSSL
|
||||||
, sizeof(ssl_stream<stream_socket>)
|
, sizeof(ssl_stream<tcp::socket>)
|
||||||
, sizeof(ssl_stream<socks5_stream>)
|
, sizeof(ssl_stream<socks5_stream>)
|
||||||
, sizeof(ssl_stream<http_stream>)
|
, sizeof(ssl_stream<http_stream>)
|
||||||
, sizeof(ssl_stream<utp_stream>)
|
, sizeof(ssl_stream<utp_stream>)
|
||||||
|
|
|
@ -210,7 +210,7 @@ namespace libtorrent
|
||||||
void wrap(char const* hostname, int port, char const* p, int len, error_code& ec);
|
void wrap(char const* hostname, int port, char const* p, int len, error_code& ec);
|
||||||
void unwrap(error_code const& e, char const* buf, int size);
|
void unwrap(error_code const& e, char const* buf, int size);
|
||||||
|
|
||||||
datagram_socket m_ipv4_sock;
|
udp::socket m_ipv4_sock;
|
||||||
deadline_timer m_timer;
|
deadline_timer m_timer;
|
||||||
int m_buf_size;
|
int m_buf_size;
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ namespace libtorrent
|
||||||
char* m_buf;
|
char* m_buf;
|
||||||
|
|
||||||
#if TORRENT_USE_IPV6
|
#if TORRENT_USE_IPV6
|
||||||
datagram_socket m_ipv6_sock;
|
udp::socket m_ipv6_sock;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
boost::uint16_t m_bind_port;
|
boost::uint16_t m_bind_port;
|
||||||
|
@ -232,7 +232,7 @@ namespace libtorrent
|
||||||
boost::uint8_t m_v6_outstanding;
|
boost::uint8_t m_v6_outstanding;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
stream_socket m_socks5_sock;
|
tcp::socket m_socks5_sock;
|
||||||
proxy_settings m_proxy_settings;
|
proxy_settings m_proxy_settings;
|
||||||
tcp::resolver m_resolver;
|
tcp::resolver m_resolver;
|
||||||
char m_tmp_buf[270];
|
char m_tmp_buf[270];
|
||||||
|
|
|
@ -176,8 +176,8 @@ class TORRENT_EXTRA_EXPORT utp_stream
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef utp_stream lowest_layer_type;
|
typedef utp_stream lowest_layer_type;
|
||||||
typedef stream_socket::endpoint_type endpoint_type;
|
typedef tcp::socket::endpoint_type endpoint_type;
|
||||||
typedef stream_socket::protocol_type protocol_type;
|
typedef tcp::socket::protocol_type protocol_type;
|
||||||
|
|
||||||
explicit utp_stream(io_service& io_service);
|
explicit utp_stream(io_service& io_service);
|
||||||
~utp_stream();
|
~utp_stream();
|
||||||
|
|
|
@ -268,10 +268,10 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
using namespace boost::asio::ip::multicast;
|
using namespace boost::asio::ip::multicast;
|
||||||
|
|
||||||
boost::shared_ptr<datagram_socket> s(new datagram_socket(ios));
|
boost::shared_ptr<udp::socket> s(new udp::socket(ios));
|
||||||
s->open(addr.is_v4() ? udp::v4() : udp::v6(), ec);
|
s->open(addr.is_v4() ? udp::v4() : udp::v6(), ec);
|
||||||
if (ec) return;
|
if (ec) return;
|
||||||
s->set_option(datagram_socket::reuse_address(true), ec);
|
s->set_option(udp::socket::reuse_address(true), ec);
|
||||||
if (ec) return;
|
if (ec) return;
|
||||||
s->bind(udp::endpoint(addr, m_multicast_endpoint.port()), ec);
|
s->bind(udp::endpoint(addr, m_multicast_endpoint.port()), ec);
|
||||||
if (ec) return;
|
if (ec) return;
|
||||||
|
@ -296,7 +296,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
using namespace boost::asio::ip::multicast;
|
using namespace boost::asio::ip::multicast;
|
||||||
error_code ec;
|
error_code ec;
|
||||||
boost::shared_ptr<datagram_socket> s(new datagram_socket(ios));
|
boost::shared_ptr<udp::socket> s(new udp::socket(ios));
|
||||||
s->open(addr.is_v4() ? udp::v4() : udp::v6(), ec);
|
s->open(addr.is_v4() ? udp::v4() : udp::v6(), ec);
|
||||||
if (ec) return;
|
if (ec) return;
|
||||||
s->bind(udp::endpoint(addr, 0), ec);
|
s->bind(udp::endpoint(addr, 0), ec);
|
||||||
|
|
|
@ -82,12 +82,12 @@ namespace libtorrent
|
||||||
#ifdef TORRENT_USE_OPENSSL
|
#ifdef TORRENT_USE_OPENSSL
|
||||||
if (ssl_context)
|
if (ssl_context)
|
||||||
{
|
{
|
||||||
s.instantiate<ssl_stream<stream_socket> >(ios, ssl_context);
|
s.instantiate<ssl_stream<tcp::socket> >(ios, ssl_context);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
s.instantiate<stream_socket>(ios);
|
s.instantiate<tcp::socket>(ios);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (ps.type == settings_pack::http
|
else if (ps.type == settings_pack::http
|
||||||
|
|
|
@ -1144,11 +1144,11 @@ namespace aux {
|
||||||
int snd_size = sett.get_int(settings_pack::send_socket_buffer_size);
|
int snd_size = sett.get_int(settings_pack::send_socket_buffer_size);
|
||||||
if (snd_size)
|
if (snd_size)
|
||||||
{
|
{
|
||||||
stream_socket::send_buffer_size prev_option;
|
tcp::socket::send_buffer_size prev_option;
|
||||||
s.get_option(prev_option, ec);
|
s.get_option(prev_option, ec);
|
||||||
if (!ec && prev_option.value() != snd_size)
|
if (!ec && prev_option.value() != snd_size)
|
||||||
{
|
{
|
||||||
stream_socket::send_buffer_size option(snd_size);
|
tcp::socket::send_buffer_size option(snd_size);
|
||||||
s.set_option(option, ec);
|
s.set_option(option, ec);
|
||||||
if (ec)
|
if (ec)
|
||||||
{
|
{
|
||||||
|
@ -1161,11 +1161,11 @@ namespace aux {
|
||||||
int recv_size = sett.get_int(settings_pack::recv_socket_buffer_size);
|
int recv_size = sett.get_int(settings_pack::recv_socket_buffer_size);
|
||||||
if (recv_size)
|
if (recv_size)
|
||||||
{
|
{
|
||||||
stream_socket::receive_buffer_size prev_option;
|
tcp::socket::receive_buffer_size prev_option;
|
||||||
s.get_option(prev_option, ec);
|
s.get_option(prev_option, ec);
|
||||||
if (!ec && prev_option.value() != recv_size)
|
if (!ec && prev_option.value() != recv_size)
|
||||||
{
|
{
|
||||||
stream_socket::receive_buffer_size option(recv_size);
|
tcp::socket::receive_buffer_size option(recv_size);
|
||||||
s.set_option(option, ec);
|
s.set_option(option, ec);
|
||||||
if (ec)
|
if (ec)
|
||||||
{
|
{
|
||||||
|
@ -1588,7 +1588,7 @@ namespace aux {
|
||||||
int last_op = 0;
|
int last_op = 0;
|
||||||
listen_failed_alert::socket_type_t sock_type = (flags & open_ssl_socket)
|
listen_failed_alert::socket_type_t sock_type = (flags & open_ssl_socket)
|
||||||
? listen_failed_alert::tcp_ssl : listen_failed_alert::tcp;
|
? listen_failed_alert::tcp_ssl : listen_failed_alert::tcp;
|
||||||
ret.sock.reset(new socket_acceptor(m_io_service));
|
ret.sock.reset(new tcp::acceptor(m_io_service));
|
||||||
ret.sock->open(ipv4 ? tcp::v4() : tcp::v6(), ec);
|
ret.sock->open(ipv4 ? tcp::v4() : tcp::v6(), ec);
|
||||||
last_op = listen_failed_alert::open;
|
last_op = listen_failed_alert::open;
|
||||||
if (ec)
|
if (ec)
|
||||||
|
@ -1609,7 +1609,7 @@ namespace aux {
|
||||||
// application. Don't do it!
|
// application. Don't do it!
|
||||||
#ifndef TORRENT_WINDOWS
|
#ifndef TORRENT_WINDOWS
|
||||||
error_code err; // ignore errors here
|
error_code err; // ignore errors here
|
||||||
ret.sock->set_option(socket_acceptor::reuse_address(true), err);
|
ret.sock->set_option(tcp::acceptor::reuse_address(true), err);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TORRENT_USE_IPV6
|
#if TORRENT_USE_IPV6
|
||||||
|
@ -2198,11 +2198,11 @@ retry:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void session_impl::async_accept(boost::shared_ptr<socket_acceptor> const& listener, bool ssl)
|
void session_impl::async_accept(boost::shared_ptr<tcp::acceptor> const& listener, bool ssl)
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(!m_abort);
|
TORRENT_ASSERT(!m_abort);
|
||||||
shared_ptr<socket_type> c(new socket_type(m_io_service));
|
shared_ptr<socket_type> c(new socket_type(m_io_service));
|
||||||
stream_socket* str = 0;
|
tcp::socket* str = 0;
|
||||||
|
|
||||||
#ifdef TORRENT_USE_OPENSSL
|
#ifdef TORRENT_USE_OPENSSL
|
||||||
if (ssl)
|
if (ssl)
|
||||||
|
@ -2211,14 +2211,14 @@ retry:
|
||||||
// use the generic m_ssl_ctx context. However, since it has
|
// use the generic m_ssl_ctx context. However, since it has
|
||||||
// the servername callback set on it, we will switch away from
|
// the servername callback set on it, we will switch away from
|
||||||
// this context into a specific torrent once we start handshaking
|
// this context into a specific torrent once we start handshaking
|
||||||
c->instantiate<ssl_stream<stream_socket> >(m_io_service, &m_ssl_ctx);
|
c->instantiate<ssl_stream<tcp::socket> >(m_io_service, &m_ssl_ctx);
|
||||||
str = &c->get<ssl_stream<stream_socket> >()->next_layer();
|
str = &c->get<ssl_stream<tcp::socket> >()->next_layer();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
c->instantiate<stream_socket>(m_io_service);
|
c->instantiate<tcp::socket>(m_io_service);
|
||||||
str = c->get<stream_socket>();
|
str = c->get<tcp::socket>();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined TORRENT_ASIO_DEBUGGING
|
#if defined TORRENT_ASIO_DEBUGGING
|
||||||
|
@ -2231,18 +2231,18 @@ retry:
|
||||||
|
|
||||||
listener->async_accept(*str
|
listener->async_accept(*str
|
||||||
, boost::bind(&session_impl::on_accept_connection, this, c
|
, boost::bind(&session_impl::on_accept_connection, this, c
|
||||||
, boost::weak_ptr<socket_acceptor>(listener), _1, ssl));
|
, boost::weak_ptr<tcp::acceptor>(listener), _1, ssl));
|
||||||
}
|
}
|
||||||
|
|
||||||
void session_impl::on_accept_connection(shared_ptr<socket_type> const& s
|
void session_impl::on_accept_connection(shared_ptr<socket_type> const& s
|
||||||
, weak_ptr<socket_acceptor> listen_socket, error_code const& e, bool ssl)
|
, weak_ptr<tcp::acceptor> listen_socket, error_code const& e, bool ssl)
|
||||||
{
|
{
|
||||||
#if defined TORRENT_ASIO_DEBUGGING
|
#if defined TORRENT_ASIO_DEBUGGING
|
||||||
complete_async("session_impl::on_accept_connection");
|
complete_async("session_impl::on_accept_connection");
|
||||||
#endif
|
#endif
|
||||||
m_stats_counters.inc_stats_counter(counters::on_accept_counter);
|
m_stats_counters.inc_stats_counter(counters::on_accept_counter);
|
||||||
TORRENT_ASSERT(is_single_thread());
|
TORRENT_ASSERT(is_single_thread());
|
||||||
boost::shared_ptr<socket_acceptor> listener = listen_socket.lock();
|
boost::shared_ptr<tcp::acceptor> listener = listen_socket.lock();
|
||||||
if (!listener) return;
|
if (!listener) return;
|
||||||
|
|
||||||
if (e == boost::asio::error::operation_aborted) return;
|
if (e == boost::asio::error::operation_aborted) return;
|
||||||
|
@ -2322,7 +2322,7 @@ retry:
|
||||||
#if defined TORRENT_ASIO_DEBUGGING
|
#if defined TORRENT_ASIO_DEBUGGING
|
||||||
add_outstanding_async("session_impl::ssl_handshake");
|
add_outstanding_async("session_impl::ssl_handshake");
|
||||||
#endif
|
#endif
|
||||||
s->get<ssl_stream<stream_socket> >()->async_accept_handshake(
|
s->get<ssl_stream<tcp::socket> >()->async_accept_handshake(
|
||||||
boost::bind(&session_impl::ssl_handshake, this, _1, s));
|
boost::bind(&session_impl::ssl_handshake, this, _1, s));
|
||||||
m_incoming_sockets.insert(s);
|
m_incoming_sockets.insert(s);
|
||||||
}
|
}
|
||||||
|
@ -2439,7 +2439,7 @@ retry:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_settings.get_bool(settings_pack::enable_incoming_tcp)
|
if (!m_settings.get_bool(settings_pack::enable_incoming_tcp)
|
||||||
&& s->get<stream_socket>())
|
&& s->get<tcp::socket>())
|
||||||
{
|
{
|
||||||
#ifndef TORRENT_DISABLE_LOGGING
|
#ifndef TORRENT_DISABLE_LOGGING
|
||||||
session_log(" rejected TCP connection");
|
session_log(" rejected TCP connection");
|
||||||
|
@ -4695,7 +4695,7 @@ retry:
|
||||||
tcp::endpoint bind_ep(address_v4(), 0);
|
tcp::endpoint bind_ep(address_v4(), 0);
|
||||||
if (m_settings.get_int(settings_pack::outgoing_port) > 0)
|
if (m_settings.get_int(settings_pack::outgoing_port) > 0)
|
||||||
{
|
{
|
||||||
s.set_option(socket_acceptor::reuse_address(true), ec);
|
s.set_option(tcp::acceptor::reuse_address(true), ec);
|
||||||
// ignore errors because the underlying socket may not
|
// ignore errors because the underlying socket may not
|
||||||
// be opened yet. This happens when we're routing through
|
// be opened yet. This happens when we're routing through
|
||||||
// a proxy. In that case, we don't yet know the address of
|
// a proxy. In that case, we don't yet know the address of
|
||||||
|
|
|
@ -55,7 +55,7 @@ namespace libtorrent
|
||||||
#define CASE(t) case socket_type_int_impl<ssl_stream<t> >::value:
|
#define CASE(t) case socket_type_int_impl<ssl_stream<t> >::value:
|
||||||
switch (s.type())
|
switch (s.type())
|
||||||
{
|
{
|
||||||
CASE(stream_socket)
|
CASE(tcp::socket)
|
||||||
CASE(socks5_stream)
|
CASE(socks5_stream)
|
||||||
CASE(http_stream)
|
CASE(http_stream)
|
||||||
CASE(utp_stream)
|
CASE(utp_stream)
|
||||||
|
@ -104,7 +104,7 @@ namespace libtorrent
|
||||||
|
|
||||||
switch(s.type())
|
switch(s.type())
|
||||||
{
|
{
|
||||||
CASE(stream_socket)
|
CASE(tcp::socket)
|
||||||
CASE(socks5_stream)
|
CASE(socks5_stream)
|
||||||
CASE(http_stream)
|
CASE(http_stream)
|
||||||
CASE(utp_stream)
|
CASE(utp_stream)
|
||||||
|
@ -161,7 +161,7 @@ namespace libtorrent
|
||||||
|
|
||||||
switch (s.type())
|
switch (s.type())
|
||||||
{
|
{
|
||||||
CASE(stream_socket)
|
CASE(tcp::socket)
|
||||||
CASE(socks5_stream)
|
CASE(socks5_stream)
|
||||||
CASE(http_stream)
|
CASE(http_stream)
|
||||||
CASE(utp_stream)
|
CASE(utp_stream)
|
||||||
|
@ -176,11 +176,12 @@ namespace libtorrent
|
||||||
|
|
||||||
void socket_type::destruct()
|
void socket_type::destruct()
|
||||||
{
|
{
|
||||||
|
typedef tcp::socket tcp_socket;
|
||||||
switch (m_type)
|
switch (m_type)
|
||||||
{
|
{
|
||||||
case 0: break;
|
case 0: break;
|
||||||
case socket_type_int_impl<stream_socket>::value:
|
case socket_type_int_impl<tcp::socket>::value:
|
||||||
get<stream_socket>()->~stream_socket();
|
get<tcp::socket>()->~tcp_socket();
|
||||||
break;
|
break;
|
||||||
case socket_type_int_impl<socks5_stream>::value:
|
case socket_type_int_impl<socks5_stream>::value:
|
||||||
get<socks5_stream>()->~socks5_stream();
|
get<socks5_stream>()->~socks5_stream();
|
||||||
|
@ -189,16 +190,16 @@ namespace libtorrent
|
||||||
get<http_stream>()->~http_stream();
|
get<http_stream>()->~http_stream();
|
||||||
break;
|
break;
|
||||||
case socket_type_int_impl<utp_stream>::value:
|
case socket_type_int_impl<utp_stream>::value:
|
||||||
get<utp_stream>()->~utp_stream();
|
get<utp_stream>()->~utp_stream();
|
||||||
break;
|
break;
|
||||||
#if TORRENT_USE_I2P
|
#if TORRENT_USE_I2P
|
||||||
case socket_type_int_impl<i2p_stream>::value:
|
case socket_type_int_impl<i2p_stream>::value:
|
||||||
get<i2p_stream>()->~i2p_stream();
|
get<i2p_stream>()->~i2p_stream();
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef TORRENT_USE_OPENSSL
|
#ifdef TORRENT_USE_OPENSSL
|
||||||
case socket_type_int_impl<ssl_stream<stream_socket> >::value:
|
case socket_type_int_impl<ssl_stream<tcp::socket> >::value:
|
||||||
get<ssl_stream<stream_socket> >()->~ssl_stream();
|
get<ssl_stream<tcp::socket> >()->~ssl_stream();
|
||||||
break;
|
break;
|
||||||
case socket_type_int_impl<ssl_stream<socks5_stream> >::value:
|
case socket_type_int_impl<ssl_stream<socks5_stream> >::value:
|
||||||
get<ssl_stream<socks5_stream> >()->~ssl_stream();
|
get<ssl_stream<socks5_stream> >()->~ssl_stream();
|
||||||
|
@ -221,8 +222,8 @@ namespace libtorrent
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case 0: break;
|
case 0: break;
|
||||||
case socket_type_int_impl<stream_socket>::value:
|
case socket_type_int_impl<tcp::socket>::value:
|
||||||
new ((stream_socket*)m_data) stream_socket(m_io_service);
|
new ((tcp::socket*)m_data) tcp::socket(m_io_service);
|
||||||
break;
|
break;
|
||||||
case socket_type_int_impl<socks5_stream>::value:
|
case socket_type_int_impl<socks5_stream>::value:
|
||||||
new ((socks5_stream*)m_data) socks5_stream(m_io_service);
|
new ((socks5_stream*)m_data) socks5_stream(m_io_service);
|
||||||
|
@ -239,9 +240,9 @@ namespace libtorrent
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef TORRENT_USE_OPENSSL
|
#ifdef TORRENT_USE_OPENSSL
|
||||||
case socket_type_int_impl<ssl_stream<stream_socket> >::value:
|
case socket_type_int_impl<ssl_stream<tcp::socket> >::value:
|
||||||
TORRENT_ASSERT(userdata);
|
TORRENT_ASSERT(userdata);
|
||||||
new ((ssl_stream<stream_socket>*)m_data) ssl_stream<stream_socket>(m_io_service
|
new ((ssl_stream<tcp::socket>*)m_data) ssl_stream<tcp::socket>(m_io_service
|
||||||
, *((boost::asio::ssl::context*)userdata));
|
, *((boost::asio::ssl::context*)userdata));
|
||||||
break;
|
break;
|
||||||
case socket_type_int_impl<ssl_stream<socks5_stream> >::value:
|
case socket_type_int_impl<ssl_stream<socks5_stream> >::value:
|
||||||
|
|
|
@ -7420,7 +7420,7 @@ namespace libtorrent
|
||||||
|
|
||||||
switch (s->type())
|
switch (s->type())
|
||||||
{
|
{
|
||||||
CASE(stream_socket)
|
CASE(tcp::socket)
|
||||||
CASE(socks5_stream)
|
CASE(socks5_stream)
|
||||||
CASE(http_stream)
|
CASE(http_stream)
|
||||||
CASE(utp_stream)
|
CASE(utp_stream)
|
||||||
|
@ -7625,7 +7625,7 @@ namespace libtorrent
|
||||||
|
|
||||||
switch (s->type())
|
switch (s->type())
|
||||||
{
|
{
|
||||||
case SSL(stream_socket)
|
case SSL(tcp::socket)
|
||||||
case SSL(socks5_stream)
|
case SSL(socks5_stream)
|
||||||
case SSL(http_stream)
|
case SSL(http_stream)
|
||||||
case SSL(utp_stream)
|
case SSL(utp_stream)
|
||||||
|
|
|
@ -423,12 +423,12 @@ namespace libtorrent
|
||||||
|
|
||||||
// only update the buffer size if it's bigger than
|
// only update the buffer size if it's bigger than
|
||||||
// what we already have
|
// what we already have
|
||||||
datagram_socket::receive_buffer_size recv_buf_size_opt;
|
udp::socket::receive_buffer_size recv_buf_size_opt;
|
||||||
m_sock.get_option(recv_buf_size_opt, ec);
|
m_sock.get_option(recv_buf_size_opt, ec);
|
||||||
if (recv_buf_size_opt.value() < size * 10)
|
if (recv_buf_size_opt.value() < size * 10)
|
||||||
{
|
{
|
||||||
m_sock.set_option(datagram_socket::receive_buffer_size(size * 10), ec);
|
m_sock.set_option(udp::socket::receive_buffer_size(size * 10), ec);
|
||||||
m_sock.set_option(datagram_socket::send_buffer_size(size * 3), ec);
|
m_sock.set_option(udp::socket::send_buffer_size(size * 3), ec);
|
||||||
}
|
}
|
||||||
m_sock_buf_size = size;
|
m_sock_buf_size = size;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ void print_session_log(lt::session& ses)
|
||||||
print_alerts(ses, "ses", true, true);
|
print_alerts(ses, "ses", true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
int read_message(stream_socket& s, char* buffer, int max_size)
|
int read_message(tcp::socket& s, char* buffer, int max_size)
|
||||||
{
|
{
|
||||||
using namespace libtorrent::detail;
|
using namespace libtorrent::detail;
|
||||||
error_code ec;
|
error_code ec;
|
||||||
|
@ -151,7 +151,7 @@ void print_message(char const* buffer, int len)
|
||||||
log("<== %s %s", message, extra);
|
log("<== %s %s", message, extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
void send_allow_fast(stream_socket& s, int piece)
|
void send_allow_fast(tcp::socket& s, int piece)
|
||||||
{
|
{
|
||||||
log("==> allow fast: %d", piece);
|
log("==> allow fast: %d", piece);
|
||||||
using namespace libtorrent::detail;
|
using namespace libtorrent::detail;
|
||||||
|
@ -164,7 +164,7 @@ void send_allow_fast(stream_socket& s, int piece)
|
||||||
if (ec) TEST_ERROR(ec.message());
|
if (ec) TEST_ERROR(ec.message());
|
||||||
}
|
}
|
||||||
|
|
||||||
void send_suggest_piece(stream_socket& s, int piece)
|
void send_suggest_piece(tcp::socket& s, int piece)
|
||||||
{
|
{
|
||||||
log("==> suggest piece: %d", piece);
|
log("==> suggest piece: %d", piece);
|
||||||
using namespace libtorrent::detail;
|
using namespace libtorrent::detail;
|
||||||
|
@ -177,7 +177,7 @@ void send_suggest_piece(stream_socket& s, int piece)
|
||||||
if (ec) TEST_ERROR(ec.message());
|
if (ec) TEST_ERROR(ec.message());
|
||||||
}
|
}
|
||||||
|
|
||||||
void send_keepalive(stream_socket& s)
|
void send_keepalive(tcp::socket& s)
|
||||||
{
|
{
|
||||||
log("==> keepalive");
|
log("==> keepalive");
|
||||||
char msg[] = "\0\0\0\0";
|
char msg[] = "\0\0\0\0";
|
||||||
|
@ -187,7 +187,7 @@ void send_keepalive(stream_socket& s)
|
||||||
if (ec) TEST_ERROR(ec.message());
|
if (ec) TEST_ERROR(ec.message());
|
||||||
}
|
}
|
||||||
|
|
||||||
void send_unchoke(stream_socket& s)
|
void send_unchoke(tcp::socket& s)
|
||||||
{
|
{
|
||||||
log("==> unchoke");
|
log("==> unchoke");
|
||||||
char msg[] = "\0\0\0\x01\x01";
|
char msg[] = "\0\0\0\x01\x01";
|
||||||
|
@ -197,7 +197,7 @@ void send_unchoke(stream_socket& s)
|
||||||
if (ec) TEST_ERROR(ec.message());
|
if (ec) TEST_ERROR(ec.message());
|
||||||
}
|
}
|
||||||
|
|
||||||
void send_have_all(stream_socket& s)
|
void send_have_all(tcp::socket& s)
|
||||||
{
|
{
|
||||||
log("==> have_all");
|
log("==> have_all");
|
||||||
char msg[] = "\0\0\0\x01\x0e"; // have_all
|
char msg[] = "\0\0\0\x01\x0e"; // have_all
|
||||||
|
@ -207,7 +207,7 @@ void send_have_all(stream_socket& s)
|
||||||
if (ec) TEST_ERROR(ec.message());
|
if (ec) TEST_ERROR(ec.message());
|
||||||
}
|
}
|
||||||
|
|
||||||
void send_have_none(stream_socket& s)
|
void send_have_none(tcp::socket& s)
|
||||||
{
|
{
|
||||||
log("==> have_none");
|
log("==> have_none");
|
||||||
char msg[] = "\0\0\0\x01\x0f"; // have_none
|
char msg[] = "\0\0\0\x01\x0f"; // have_none
|
||||||
|
@ -217,7 +217,7 @@ void send_have_none(stream_socket& s)
|
||||||
if (ec) TEST_ERROR(ec.message());
|
if (ec) TEST_ERROR(ec.message());
|
||||||
}
|
}
|
||||||
|
|
||||||
void send_bitfield(stream_socket& s, char const* bits)
|
void send_bitfield(tcp::socket& s, char const* bits)
|
||||||
{
|
{
|
||||||
using namespace libtorrent::detail;
|
using namespace libtorrent::detail;
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ void send_bitfield(stream_socket& s, char const* bits)
|
||||||
if (ec) TEST_ERROR(ec.message());
|
if (ec) TEST_ERROR(ec.message());
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_handshake(stream_socket& s, sha1_hash const& ih, char* buffer)
|
void do_handshake(tcp::socket& s, sha1_hash const& ih, char* buffer)
|
||||||
{
|
{
|
||||||
char handshake[] = "\x13" "BitTorrent protocol\0\0\0\0\0\x10\0\x04"
|
char handshake[] = "\x13" "BitTorrent protocol\0\0\0\0\0\x10\0\x04"
|
||||||
" " // space for info-hash
|
" " // space for info-hash
|
||||||
|
@ -285,7 +285,7 @@ void do_handshake(stream_socket& s, sha1_hash const& ih, char* buffer)
|
||||||
TEST_CHECK(std::memcmp(buffer + 28, ih.begin(), 20) == 0);
|
TEST_CHECK(std::memcmp(buffer + 28, ih.begin(), 20) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void send_extension_handshake(stream_socket& s, entry const& e)
|
void send_extension_handshake(tcp::socket& s, entry const& e)
|
||||||
{
|
{
|
||||||
std::vector<char> buf;
|
std::vector<char> buf;
|
||||||
|
|
||||||
|
@ -310,7 +310,7 @@ void send_extension_handshake(stream_socket& s, entry const& e)
|
||||||
if (ec) TEST_ERROR(ec.message());
|
if (ec) TEST_ERROR(ec.message());
|
||||||
}
|
}
|
||||||
|
|
||||||
entry read_extension_handshake(stream_socket& s, char* recv_buffer, int size)
|
entry read_extension_handshake(tcp::socket& s, char* recv_buffer, int size)
|
||||||
{
|
{
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
@ -332,7 +332,7 @@ entry read_extension_handshake(stream_socket& s, char* recv_buffer, int size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void send_ut_metadata_msg(stream_socket& s, int ut_metadata_msg, int type, int piece)
|
void send_ut_metadata_msg(tcp::socket& s, int ut_metadata_msg, int type, int piece)
|
||||||
{
|
{
|
||||||
std::vector<char> buf;
|
std::vector<char> buf;
|
||||||
|
|
||||||
|
@ -362,7 +362,7 @@ void send_ut_metadata_msg(stream_socket& s, int ut_metadata_msg, int type, int p
|
||||||
if (ec) TEST_ERROR(ec.message());
|
if (ec) TEST_ERROR(ec.message());
|
||||||
}
|
}
|
||||||
|
|
||||||
entry read_ut_metadata_msg(stream_socket& s, char* recv_buffer, int size)
|
entry read_ut_metadata_msg(tcp::socket& s, char* recv_buffer, int size)
|
||||||
{
|
{
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
@ -384,7 +384,7 @@ entry read_ut_metadata_msg(stream_socket& s, char* recv_buffer, int size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<torrent_info> setup_peer(stream_socket& s, sha1_hash& ih
|
boost::shared_ptr<torrent_info> setup_peer(tcp::socket& s, sha1_hash& ih
|
||||||
, boost::shared_ptr<lt::session>& ses, torrent_handle* th = NULL)
|
, boost::shared_ptr<lt::session>& ses, torrent_handle* th = NULL)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<torrent_info> t = ::create_torrent();
|
boost::shared_ptr<torrent_info> t = ::create_torrent();
|
||||||
|
@ -427,7 +427,7 @@ void test_reject_fast()
|
||||||
sha1_hash ih;
|
sha1_hash ih;
|
||||||
boost::shared_ptr<lt::session> ses;
|
boost::shared_ptr<lt::session> ses;
|
||||||
io_service ios;
|
io_service ios;
|
||||||
stream_socket s(ios);
|
tcp::socket s(ios);
|
||||||
setup_peer(s, ih, ses);
|
setup_peer(s, ih, ses);
|
||||||
|
|
||||||
char recv_buffer[1000];
|
char recv_buffer[1000];
|
||||||
|
@ -495,7 +495,7 @@ void test_respect_suggest()
|
||||||
sha1_hash ih;
|
sha1_hash ih;
|
||||||
boost::shared_ptr<lt::session> ses;
|
boost::shared_ptr<lt::session> ses;
|
||||||
io_service ios;
|
io_service ios;
|
||||||
stream_socket s(ios);
|
tcp::socket s(ios);
|
||||||
setup_peer(s, ih, ses);
|
setup_peer(s, ih, ses);
|
||||||
|
|
||||||
char recv_buffer[1000];
|
char recv_buffer[1000];
|
||||||
|
@ -573,7 +573,7 @@ void test_multiple_bitfields()
|
||||||
sha1_hash ih;
|
sha1_hash ih;
|
||||||
boost::shared_ptr<lt::session> ses;
|
boost::shared_ptr<lt::session> ses;
|
||||||
io_service ios;
|
io_service ios;
|
||||||
stream_socket s(ios);
|
tcp::socket s(ios);
|
||||||
boost::shared_ptr<torrent_info> ti = setup_peer(s, ih, ses);
|
boost::shared_ptr<torrent_info> ti = setup_peer(s, ih, ses);
|
||||||
print_session_log(*ses);
|
print_session_log(*ses);
|
||||||
|
|
||||||
|
@ -607,7 +607,7 @@ void test_multiple_have_all()
|
||||||
sha1_hash ih;
|
sha1_hash ih;
|
||||||
boost::shared_ptr<lt::session> ses;
|
boost::shared_ptr<lt::session> ses;
|
||||||
io_service ios;
|
io_service ios;
|
||||||
stream_socket s(ios);
|
tcp::socket s(ios);
|
||||||
boost::shared_ptr<torrent_info> ti = setup_peer(s, ih, ses);
|
boost::shared_ptr<torrent_info> ti = setup_peer(s, ih, ses);
|
||||||
|
|
||||||
char recv_buffer[1000];
|
char recv_buffer[1000];
|
||||||
|
@ -641,7 +641,7 @@ void test_dont_have()
|
||||||
torrent_handle th;
|
torrent_handle th;
|
||||||
boost::shared_ptr<lt::session> ses;
|
boost::shared_ptr<lt::session> ses;
|
||||||
io_service ios;
|
io_service ios;
|
||||||
stream_socket s(ios);
|
tcp::socket s(ios);
|
||||||
boost::shared_ptr<torrent_info> ti = setup_peer(s, ih, ses, &th);
|
boost::shared_ptr<torrent_info> ti = setup_peer(s, ih, ses, &th);
|
||||||
|
|
||||||
char recv_buffer[1000];
|
char recv_buffer[1000];
|
||||||
|
@ -742,7 +742,7 @@ void test_invalid_metadata_requests()
|
||||||
sha1_hash ih;
|
sha1_hash ih;
|
||||||
boost::shared_ptr<lt::session> ses;
|
boost::shared_ptr<lt::session> ses;
|
||||||
io_service ios;
|
io_service ios;
|
||||||
stream_socket s(ios);
|
tcp::socket s(ios);
|
||||||
boost::shared_ptr<torrent_info> ti = setup_peer(s, ih, ses);
|
boost::shared_ptr<torrent_info> ti = setup_peer(s, ih, ses);
|
||||||
|
|
||||||
char recv_buffer[1000];
|
char recv_buffer[1000];
|
||||||
|
|
|
@ -417,7 +417,7 @@ bool try_connect(libtorrent::session& ses1, int port
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::asio::ssl::stream<boost::asio::ip::tcp::socket> ssl_sock(ios, ctx);
|
boost::asio::ssl::stream<tcp::socket> ssl_sock(ios, ctx);
|
||||||
|
|
||||||
fprintf(stderr, "connecting 127.0.0.1:%d\n", port);
|
fprintf(stderr, "connecting 127.0.0.1:%d\n", port);
|
||||||
ssl_sock.lowest_layer().connect(tcp::endpoint(
|
ssl_sock.lowest_layer().connect(tcp::endpoint(
|
||||||
|
|
Loading…
Reference in New Issue