merged uTP branch into trunk (yay)

This commit is contained in:
Arvid Norberg
2010-11-29 01:33:05 +00:00
parent 5a1669cf03
commit e5f980d80d
77 changed files with 7497 additions and 630 deletions

View File

@@ -82,13 +82,31 @@ namespace libtorrent
proxy_settings const& get_proxy_settings() { return m_proxy_settings; }
bool is_closed() const { return m_abort; }
tcp::endpoint local_endpoint() const
tcp::endpoint local_endpoint(error_code& ec) const
{
error_code ec;
udp::endpoint ep = m_ipv4_sock.local_endpoint(ec);
return tcp::endpoint(ep.address(), ep.port());
}
void set_buf_size(int s);
template <class SocketOption>
void set_option(SocketOption const& opt, error_code& ec)
{
m_ipv4_sock.set_option(opt, ec);
#if TORRENT_USE_IPV6
m_ipv6_sock.set_option(opt, ec);
#endif
}
template <class SocketOption>
void get_option(SocketOption& opt, error_code& ec)
{
m_ipv4_sock.get_option(opt, ec);
}
udp::endpoint proxy_addr() const { return m_proxy_addr; }
protected:
struct queued_packet
@@ -129,6 +147,8 @@ namespace libtorrent
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 maybe_realloc_buffers();
#ifdef TORRENT_DEBUG
#if defined BOOST_HAS_PTHREADS
mutable pthread_t m_thread;
@@ -146,12 +166,14 @@ namespace libtorrent
udp::socket m_ipv4_sock;
udp::endpoint m_v4_ep;
char m_v4_buf[1600];
int m_v4_buf_size;
char* m_v4_buf;
#if TORRENT_USE_IPV6
udp::socket m_ipv6_sock;
udp::endpoint m_v6_ep;
char m_v6_buf[1600];
int m_v6_buf_size;
char* m_v6_buf;
#endif
int m_bind_port;
@@ -166,6 +188,11 @@ namespace libtorrent
bool m_queue_packets;
bool m_tunnel_packets;
bool m_abort;
// this is set to true to indicate that the m_v4_buf
// and m_v6_buf should be reallocated to the size
// of the buffer size members the next time their
// read handler gets triggered
bool m_reallocate_buffers;
udp::endpoint m_proxy_addr;
// while we're connecting to the proxy
// we have to queue the packets, we'll flush