modified get_default_gateway to not take an interface

This commit is contained in:
Arvid Norberg 2008-04-28 02:20:40 +00:00
parent 3ec9a75d09
commit c3b60f1b8f
4 changed files with 11 additions and 3 deletions

View File

@ -14,6 +14,14 @@ int main()
address local = guess_local_address(ios);
std::cout << "Local address: " << local << std::endl;
address def_gw = get_default_gateway(ios, ec);
if (ec)
{
std::cerr << ec.message() << std::endl;
return 1;
}
std::cout << "Default gateway: " << def_gw << std::endl;
std::cout << "=========== Routes ===========\n";
std::vector<ip_route> routes = enum_routes(ios, ec);
if (ec)

View File

@ -70,7 +70,7 @@ namespace libtorrent
TORRENT_EXPORT bool in_local_network(asio::io_service& ios, address const& addr
, asio::error_code& ec);
TORRENT_EXPORT address get_default_gateway(asio::io_service& ios, address const& addr
TORRENT_EXPORT address get_default_gateway(asio::io_service& ios
, asio::error_code& ec);
}

View File

@ -356,7 +356,7 @@ namespace libtorrent
return ret;
}
address get_default_gateway(asio::io_service& ios, address const& interface, asio::error_code& ec)
address get_default_gateway(asio::io_service& ios, asio::error_code& ec)
{
std::vector<ip_route> ret = enum_routes(ios, ec);
std::vector<ip_route>::iterator i = std::find_if(ret.begin(), ret.end()

View File

@ -64,7 +64,7 @@ void natpmp::rebind(address const& listen_interface)
mutex_t::scoped_lock l(m_mutex);
asio::error_code ec;
address gateway = get_default_gateway(m_socket.get_io_service(), listen_interface, ec);
address gateway = get_default_gateway(m_socket.get_io_service(), ec);
if (ec)
{
#if defined(TORRENT_LOGGING) || defined(TORRENT_VERBOSE_LOGGING)