fixed #255. write_resume_data does no longer throw if there are IPv6 addresses without having IPv6 installed on windows

This commit is contained in:
Arvid Norberg 2008-01-26 07:31:33 +00:00
parent f783d4d869
commit 7faa922dc5
1 changed files with 5 additions and 2 deletions

View File

@ -599,11 +599,13 @@ namespace libtorrent
for (policy::iterator i = pol.begin_peer() for (policy::iterator i = pol.begin_peer()
, end(pol.end_peer()); i != end; ++i) , end(pol.end_peer()); i != end; ++i)
{ {
asio::error_code ec;
if (i->second.banned) if (i->second.banned)
{ {
tcp::endpoint ip = i->second.ip; tcp::endpoint ip = i->second.ip;
entry peer(entry::dictionary_t); entry peer(entry::dictionary_t);
peer["ip"] = ip.address().to_string(); peer["ip"] = ip.address().to_string(ec);
if (ec) continue;
peer["port"] = ip.port(); peer["port"] = ip.port();
banned_peer_list.push_back(peer); banned_peer_list.push_back(peer);
continue; continue;
@ -619,7 +621,8 @@ namespace libtorrent
tcp::endpoint ip = i->second.ip; tcp::endpoint ip = i->second.ip;
entry peer(entry::dictionary_t); entry peer(entry::dictionary_t);
peer["ip"] = ip.address().to_string(); peer["ip"] = ip.address().to_string(ec);
if (ec) continue;
peer["port"] = ip.port(); peer["port"] = ip.port();
peer_list.push_back(peer); peer_list.push_back(peer);
} }