@@ -189,6 +189,11 @@ namespace libtorrent {
189
189
190
190
namespace aux {
191
191
192
+ constexpr ip_source_t session_interface::source_dht;
193
+ constexpr ip_source_t session_interface::source_peer;
194
+ constexpr ip_source_t session_interface::source_tracker;
195
+ constexpr ip_source_t session_interface::source_router;
196
+
192
197
std::vector<std::shared_ptr<listen_socket_t >>::iterator partition_listen_sockets (
193
198
std::vector<listen_endpoint_t >& eps
194
199
, std::vector<std::shared_ptr<listen_socket_t >>& sockets)
@@ -6638,13 +6643,14 @@ namespace {
6638
6643
}
6639
6644
6640
6645
// this is the DHT observer version. DHT is the implied source
6641
- void session_impl::set_external_address (aux::listen_socket_handle const & iface, address const & ip
6642
- , address const & source)
6646
+ void session_impl::set_external_address (aux::listen_socket_handle const & iface
6647
+ , address const & ip, address const & source)
6643
6648
{
6644
6649
auto i = iface.m_sock .lock ();
6645
6650
TORRENT_ASSERT (i);
6646
6651
if (!i) return ;
6647
- set_external_address (std::static_pointer_cast<listen_socket_t >(i), ip, source_dht, source);
6652
+ set_external_address (std::static_pointer_cast<listen_socket_t >(i), ip
6653
+ , source_dht, source);
6648
6654
}
6649
6655
6650
6656
void session_impl::get_peers (sha1_hash const & ih)
@@ -6738,7 +6744,7 @@ namespace {
6738
6744
}
6739
6745
6740
6746
void session_impl::set_external_address (address const & ip
6741
- , int const source_type, address const & source)
6747
+ , ip_source_t const source_type, address const & source)
6742
6748
{
6743
6749
// for now, just pick the first socket with a matching address family
6744
6750
// TODO: remove this function once all callers are updated to specify a listen socket
@@ -6754,7 +6760,7 @@ namespace {
6754
6760
6755
6761
void session_impl::set_external_address (
6756
6762
tcp::endpoint const & local_endpoint, address const & ip
6757
- , int const source_type, address const & source)
6763
+ , ip_source_t const source_type, address const & source)
6758
6764
{
6759
6765
auto sock = std::find_if (m_listen_sockets.begin (), m_listen_sockets.end ()
6760
6766
, [&](std::shared_ptr<listen_socket_t > const & v) { return v->local_endpoint == local_endpoint; });
@@ -6764,13 +6770,15 @@ namespace {
6764
6770
}
6765
6771
6766
6772
void session_impl::set_external_address (std::shared_ptr<listen_socket_t > const & sock
6767
- , address const & ip, int const source_type, address const & source)
6773
+ , address const & ip, ip_source_t const source_type, address const & source)
6768
6774
{
6769
6775
#ifndef TORRENT_DISABLE_LOGGING
6770
6776
if (should_log ())
6771
6777
{
6772
- session_log (" : set_external_address(%s, %d, %s)" , print_address (ip).c_str ()
6773
- , source_type, print_address (source).c_str ());
6778
+ session_log (" : set_external_address(%s, %d, %s)"
6779
+ , print_address (ip).c_str ()
6780
+ , static_cast <std::uint8_t >(source_type)
6781
+ , print_address (source).c_str ());
6774
6782
}
6775
6783
#endif
6776
6784
0 commit comments