move socket_type into aux-namespace

This commit is contained in:
arvidn 2018-01-28 11:48:21 +01:00 committed by Arvid Norberg
parent 348bc2b4fe
commit e126d7bce0
21 changed files with 39 additions and 80 deletions

View File

@ -127,8 +127,6 @@ nobase_include_HEADERS = \
sliding_average.hpp \
socket.hpp \
socket_io.hpp \
socket_type.hpp \
socket_type_fwd.hpp \
socks5_stream.hpp \
ssl_stream.hpp \
stack_allocator.hpp \
@ -191,6 +189,7 @@ nobase_include_HEADERS = \
aux_/proxy_settings.hpp \
aux_/session_interface.hpp \
aux_/suggest_piece.hpp \
aux_/socket_type.hpp \
aux_/storage_piece_set.hpp \
aux_/string_ptr.hpp \
aux_/time.hpp \

View File

@ -37,7 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/session_settings.hpp"
#include "libtorrent/aux_/session_interface.hpp"
#include "libtorrent/aux_/session_udp_sockets.hpp"
#include "libtorrent/linked_list.hpp"
#include "libtorrent/aux_/socket_type.hpp"
#include "libtorrent/torrent_peer.hpp"
#include "libtorrent/torrent_peer_allocator.hpp"
#include "libtorrent/performance_counters.hpp" // for counters
@ -62,7 +62,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/stat.hpp"
#include "libtorrent/file_pool.hpp"
#include "libtorrent/bandwidth_manager.hpp"
#include "libtorrent/socket_type.hpp"
#include "libtorrent/disk_io_thread.hpp"
#include "libtorrent/udp_socket.hpp"
#include "libtorrent/assert.hpp"

View File

@ -78,7 +78,6 @@ namespace libtorrent {
struct tracker_request;
struct request_callback;
struct utp_socket_manager;
struct socket_type;
struct block_info;
struct external_ip;
struct torrent_handle;
@ -104,10 +103,12 @@ namespace dht {
#endif
}
namespace libtorrent { namespace aux {
namespace libtorrent {
namespace aux {
struct proxy_settings;
struct session_settings;
struct socket_type;
struct ip_source_tag;
using ip_source_t = flags::bitfield_flag<std::uint8_t, ip_source_tag>;

View File

@ -130,6 +130,7 @@ POSSIBILITY OF SUCH DAMAGE.
}
namespace libtorrent {
namespace aux {
template <class S>
struct socket_type_int_impl
@ -341,5 +342,6 @@ namespace libtorrent {
// properly shuts down SSL sockets. holder keeps s alive
void async_shutdown(socket_type& s, std::shared_ptr<void> holder);
}
}
#endif

View File

@ -53,8 +53,6 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
struct socket_type;
// the interface should not have a netmask
struct ip_interface
{

View File

@ -53,8 +53,8 @@ namespace ssl {
#include "libtorrent/http_parser.hpp"
#include "libtorrent/deadline_timer.hpp"
#include "libtorrent/assert.hpp"
#include "libtorrent/socket_type.hpp"
#include "libtorrent/i2p_stream.hpp"
#include "libtorrent/aux_/socket_type.hpp"
#include "libtorrent/aux_/vector.hpp"
#include "libtorrent/resolver_interface.hpp"
#include "libtorrent/optional.hpp"
@ -125,7 +125,7 @@ struct TORRENT_EXTRA_EXPORT http_connection
void close(bool force = false);
socket_type const& socket() const { return m_sock; }
aux::socket_type const& socket() const { return m_sock; }
std::vector<tcp::endpoint> const& endpoints() const { return m_endpoints; }
@ -160,7 +160,7 @@ private:
// endpoint with this index (in m_endpoints) next
int m_next_ep;
socket_type m_sock;
aux::socket_type m_sock;
#ifdef TORRENT_USE_OPENSSL
ssl::context* m_ssl_ctx;

View File

@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_INSTANTIATE_CONNECTION
#define TORRENT_INSTANTIATE_CONNECTION
#include "libtorrent/socket_type.hpp"
#include "libtorrent/aux_/socket_type.hpp"
namespace libtorrent {
@ -43,11 +43,10 @@ namespace libtorrent {
}
struct utp_socket_manager;
struct socket_type;
// instantiate a socket_type (s) according to the specified criteria
TORRENT_EXTRA_EXPORT bool instantiate_connection(io_service& ios
, aux::proxy_settings const& ps, socket_type& s
, aux::proxy_settings const& ps, aux::socket_type& s
, void* ssl_context
, utp_socket_manager* sm
, bool peer_connection

View File

@ -41,13 +41,11 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/peer_request.hpp"
#include "libtorrent/piece_block_progress.hpp"
#include "libtorrent/bandwidth_limit.hpp"
#include "libtorrent/socket_type_fwd.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"
#include "libtorrent/error_code.hpp"
#include "libtorrent/sliding_average.hpp"
#include "libtorrent/peer_class.hpp"
@ -89,7 +87,9 @@ namespace libtorrent {
namespace aux {
struct socket_type;
struct session_interface;
}
struct pending_block
@ -143,7 +143,7 @@ namespace aux {
disk_interface* disk_thread;
io_service* ios;
std::weak_ptr<torrent> tor;
std::shared_ptr<socket_type> s;
std::shared_ptr<aux::socket_type> s;
tcp::endpoint endp;
torrent_peer* peerinfo;
};
@ -444,7 +444,7 @@ namespace aux {
void timeout_requests();
std::shared_ptr<socket_type> get_socket() const { return m_socket; }
std::shared_ptr<aux::socket_type> get_socket() const { return m_socket; }
tcp::endpoint const& remote() const override { return m_remote; }
tcp::endpoint local_endpoint() const override { return m_local; }
@ -775,7 +775,7 @@ namespace aux {
int wanted_transfer(int channel);
int request_bandwidth(int channel, int bytes = 0);
std::shared_ptr<socket_type> m_socket;
std::shared_ptr<aux::socket_type> m_socket;
// the queue of blocks we have requested
// from this peer

View File

@ -1,42 +0,0 @@
/*
Copyright (c) 2009-2016, 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

View File

@ -36,7 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <map>
#include <functional>
#include "libtorrent/socket_type.hpp"
#include "libtorrent/aux_/socket_type.hpp"
#include "libtorrent/session_status.hpp"
#include "libtorrent/enum_net.hpp"
#include "libtorrent/aux_/session_settings.hpp"
@ -64,7 +64,7 @@ namespace libtorrent {
, span<char const>
, error_code&, udp_send_flags_t)>;
using incoming_utp_callback_t = std::function<void(std::shared_ptr<socket_type> const&)>;
using incoming_utp_callback_t = std::function<void(std::shared_ptr<aux::socket_type> const&)>;
utp_socket_manager(send_fun_t const& send_fun
, incoming_utp_callback_t const& cb

View File

@ -58,7 +58,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/peer_info.hpp"
#include "libtorrent/random.hpp"
#include "libtorrent/aux_/alloca.hpp"
#include "libtorrent/socket_type.hpp"
#include "libtorrent/aux_/socket_type.hpp"
#include "libtorrent/performance_counters.hpp" // for counters
#include "libtorrent/alert_manager.hpp" // for alert_manager
#include "libtorrent/string_util.hpp" // for search

View File

@ -34,7 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/enum_net.hpp"
#include "libtorrent/broadcast_socket.hpp"
#include "libtorrent/assert.hpp"
#include "libtorrent/socket_type.hpp"
#include "libtorrent/aux_/socket_type.hpp"
#ifdef TORRENT_WINDOWS
#include "libtorrent/aux_/win_util.hpp"
#endif

View File

@ -36,7 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/gzip.hpp"
#include "libtorrent/parse_url.hpp"
#include "libtorrent/socket.hpp"
#include "libtorrent/socket_type.hpp" // for async_shutdown
#include "libtorrent/aux_/socket_type.hpp" // for async_shutdown
#include "libtorrent/resolver_interface.hpp"
#include "libtorrent/settings_pack.hpp"
#include "libtorrent/aux_/time.hpp"

View File

@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/socket.hpp"
#include "libtorrent/socket_type.hpp"
#include "libtorrent/aux_/socket_type.hpp"
#include "libtorrent/utp_socket_manager.hpp"
#include "libtorrent/instantiate_connection.hpp"
@ -40,7 +40,7 @@ namespace libtorrent {
// TODO: 2 peer_connection and tracker_connection should probably be flags
// TODO: 2 move this function into libtorrent::aux namespace
bool instantiate_connection(io_service& ios
, aux::proxy_settings const& ps, socket_type& s
, aux::proxy_settings const& ps, aux::socket_type& s
, void* ssl_context
, utp_socket_manager* sm
, bool peer_connection

View File

@ -44,7 +44,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/extensions.hpp"
#include "libtorrent/aux_/session_interface.hpp"
#include "libtorrent/peer_list.hpp"
#include "libtorrent/socket_type.hpp"
#include "libtorrent/aux_/socket_type.hpp"
#include "libtorrent/assert.hpp"
#include "libtorrent/broadcast_socket.hpp"
#include "libtorrent/torrent.hpp"

View File

@ -36,7 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/web_peer_connection.hpp"
#include "libtorrent/peer_list.hpp"
#include "libtorrent/socket.hpp"
#include "libtorrent/socket_type.hpp"
#include "libtorrent/aux_/socket_type.hpp"
#include "libtorrent/invariant_check.hpp"
#include "libtorrent/time.hpp"
#include "libtorrent/aux_/session_interface.hpp"

View File

@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/bitfield.hpp"
#include "libtorrent/peer_connection.hpp"
#include "libtorrent/torrent.hpp"
#include "libtorrent/socket_type.hpp"
#include "libtorrent/aux_/socket_type.hpp"
#include "libtorrent/peer_info.hpp" // for peer_info flags
#include "libtorrent/performance_counters.hpp" // for counters
#include "libtorrent/request_blocks.hpp"

View File

@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/config.hpp"
#include "libtorrent/socket_type.hpp"
#include "libtorrent/aux_/socket_type.hpp"
#include "libtorrent/aux_/openssl.hpp"
#ifdef TORRENT_USE_OPENSSL
@ -43,6 +43,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/debug.hpp"
namespace libtorrent {
namespace aux {
bool is_ssl(socket_type const& s)
{
@ -396,3 +397,5 @@ namespace libtorrent {
#endif
}
}

View File

@ -5910,8 +5910,8 @@ namespace libtorrent {
if (!web->have_files.empty()
&& web->have_files.none_set()) return;
std::shared_ptr<socket_type> s
= std::make_shared<socket_type>(m_ses.get_io_service());
std::shared_ptr<aux::socket_type> s
= std::make_shared<aux::socket_type>(m_ses.get_io_service());
if (!s) return;
void* userdata = nullptr;
@ -6488,7 +6488,7 @@ namespace libtorrent {
|| !m_ip_filter
|| (m_ip_filter->access(peerinfo->address()) & ip_filter::blocked) == 0);
std::shared_ptr<socket_type> s = std::make_shared<socket_type>(m_ses.get_io_service());
std::shared_ptr<aux::socket_type> s = std::make_shared<aux::socket_type>(m_ses.get_io_service());
#if TORRENT_USE_I2P
bool const i2p = peerinfo->is_i2p_addr;
@ -6562,7 +6562,7 @@ namespace libtorrent {
// for ssl sockets, set the hostname
std::string host_name = aux::to_hex(m_torrent_file->info_hash());
#define CASE(t) case socket_type_int_impl<ssl_stream<t>>::value: \
#define CASE(t) case aux::socket_type_int_impl<ssl_stream<t>>::value: \
s->get<ssl_stream<t>>()->set_host_name(host_name); break;
switch (s->type())
@ -6750,10 +6750,10 @@ namespace libtorrent {
if (is_ssl_torrent())
{
// if this is an SSL torrent, don't allow non SSL peers on it
std::shared_ptr<socket_type> s = p->get_socket();
std::shared_ptr<aux::socket_type> s = p->get_socket();
//
#define SSL(t) socket_type_int_impl<ssl_stream<t>>::value: \
#define SSL(t) aux::socket_type_int_impl<ssl_stream<t>>::value: \
ssl_conn = s->get<ssl_stream<t>>()->native_handle(); \
break;

View File

@ -39,7 +39,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/broadcast_socket.hpp"
#include "libtorrent/socket_io.hpp"
#include "libtorrent/peer_info.hpp"
#include "libtorrent/socket_type.hpp" // for is_utp
#include "libtorrent/aux_/socket_type.hpp" // for is_utp
#include "libtorrent/performance_counters.hpp" // for counters
#include "libtorrent/extensions/ut_pex.hpp"
#include "libtorrent/aux_/time.hpp"

View File

@ -209,7 +209,7 @@ namespace libtorrent {
// UTP_LOGV("not found, new connection id:%d\n", m_new_connection);
std::shared_ptr<socket_type> c(new (std::nothrow) socket_type(m_ios));
std::shared_ptr<aux::socket_type> c(new (std::nothrow) aux::socket_type(m_ios));
if (!c) return false;
TORRENT_ASSERT(m_new_connection == -1);