Merge pull request #468 from arvidn/renaming-session-members

rename a few members of session_impl to be more descriptive
This commit is contained in:
Arvid Norberg 2016-02-09 08:14:22 -05:00
commit 26de9d1743
2 changed files with 15 additions and 16 deletions

View File

@ -210,7 +210,7 @@ namespace libtorrent
bool m_posting_torrent_updates; bool m_posting_torrent_updates;
#endif #endif
void open_listen_port(); void reopen_listen_sockets();
torrent_peer_allocator_interface* get_peer_allocator() TORRENT_OVERRIDE torrent_peer_allocator_interface* get_peer_allocator() TORRENT_OVERRIDE
{ return &m_peer_allocator; } { return &m_peer_allocator; }
@ -848,8 +848,7 @@ namespace libtorrent
// socket to, and the device or IP determines which network adapter // socket to, and the device or IP determines which network adapter
// to be used. If no adapter with the specified name exists, the listen // to be used. If no adapter with the specified name exists, the listen
// socket fails. // socket fails.
// TODO: should this be renamed m_outgoing_interfaces? std::vector<std::string> m_outgoing_interfaces;
std::vector<std::string> m_net_interfaces;
// if we're listening on an IPv6 interface // if we're listening on an IPv6 interface
// this is one of the non local IPv6 interfaces // this is one of the non local IPv6 interfaces
@ -877,7 +876,7 @@ namespace libtorrent
boost::shared_ptr<socket_type> m_socks_listen_socket; boost::shared_ptr<socket_type> m_socks_listen_socket;
boost::uint16_t m_socks_listen_port; boost::uint16_t m_socks_listen_port;
// round-robin index into m_net_interfaces // round-robin index into m_outgoing_interfaces
mutable boost::uint8_t m_interface_index; mutable boost::uint8_t m_interface_index;
void open_new_incoming_socks_connection(); void open_new_incoming_socks_connection();

View File

@ -631,7 +631,7 @@ namespace aux {
if (m_listen_sockets.empty()) if (m_listen_sockets.empty())
{ {
update_listen_interfaces(); update_listen_interfaces();
open_listen_port(); reopen_listen_sockets();
} }
} }
@ -1603,7 +1603,7 @@ namespace aux {
if (reopen_listen_port) if (reopen_listen_port)
{ {
error_code ec; error_code ec;
open_listen_port(); reopen_listen_sockets();
} }
} }
@ -1774,7 +1774,7 @@ namespace aux {
return ret; return ret;
} }
void session_impl::open_listen_port() void session_impl::reopen_listen_sockets()
{ {
#ifndef TORRENT_DISABLE_LOGGING #ifndef TORRENT_DISABLE_LOGGING
session_log("open listen port"); session_log("open listen port");
@ -4900,7 +4900,7 @@ retry:
std::string net_interfaces = m_settings.get_str(settings_pack::outgoing_interfaces); std::string net_interfaces = m_settings.get_str(settings_pack::outgoing_interfaces);
// declared in string_util.hpp // declared in string_util.hpp
parse_comma_separated_string(net_interfaces, m_net_interfaces); parse_comma_separated_string(net_interfaces, m_outgoing_interfaces);
} }
tcp::endpoint session_impl::bind_outgoing_socket(socket_type& s, address tcp::endpoint session_impl::bind_outgoing_socket(socket_type& s, address
@ -4924,10 +4924,10 @@ retry:
bind_ep.port(next_port()); bind_ep.port(next_port());
} }
if (!m_net_interfaces.empty()) if (!m_outgoing_interfaces.empty())
{ {
if (m_interface_index >= m_net_interfaces.size()) m_interface_index = 0; if (m_interface_index >= m_outgoing_interfaces.size()) m_interface_index = 0;
std::string const& ifname = m_net_interfaces[m_interface_index++]; std::string const& ifname = m_outgoing_interfaces[m_interface_index++];
if (ec) return bind_ep; if (ec) return bind_ep;
@ -4971,11 +4971,11 @@ retry:
// we have specific outgoing interfaces specified. Make sure the // we have specific outgoing interfaces specified. Make sure the
// local endpoint for this socket is bound to one of the allowed // local endpoint for this socket is bound to one of the allowed
// interfaces. the list can be a mixture of interfaces and IP // interfaces. the list can be a mixture of interfaces and IP
// addresses. first look for the address // addresses.
for (int i = 0; i < int(m_net_interfaces.size()); ++i) for (int i = 0; i < int(m_outgoing_interfaces.size()); ++i)
{ {
error_code err; error_code err;
address ip = address::from_string(m_net_interfaces[i].c_str(), err); address ip = address::from_string(m_outgoing_interfaces[i].c_str(), err);
if (err) continue; if (err) continue;
if (ip == addr) return true; if (ip == addr) return true;
} }
@ -4988,9 +4988,9 @@ retry:
// if no device was found to have this address, we fail // if no device was found to have this address, we fail
if (device.empty()) return false; if (device.empty()) return false;
for (int i = 0; i < int(m_net_interfaces.size()); ++i) for (int i = 0; i < int(m_outgoing_interfaces.size()); ++i)
{ {
if (m_net_interfaces[i] == device) return true; if (m_outgoing_interfaces[i] == device) return true;
} }
return false; return false;