peers that throw in the connection attempt are now removed from the policy's list. added more asserts to session. disabled SIGPIPE on darwin
This commit is contained in:
parent
b065130762
commit
75dafc5d1b
|
@ -106,3 +106,12 @@ td
|
|||
border: 1px solid black
|
||||
}
|
||||
|
||||
div.warning, div.note, div.important {
|
||||
width: 80%;
|
||||
margin: 1.5em auto;
|
||||
background: #C1E5F6;
|
||||
background: #F1FFF5;
|
||||
border: solid 1px #D1DFD5;
|
||||
padding: 5px 10px 5px 10px;
|
||||
}
|
||||
|
||||
|
|
|
@ -441,7 +441,7 @@ int main(int ac, char* av[])
|
|||
("save-path,s", po::value<std::string>(&save_path_str)->default_value("./")
|
||||
, "the path where the downloaded file/folder should be placed.")
|
||||
("log-level,l", po::value<std::string>(&log_level)->default_value("info")
|
||||
, "sets the level at which events are logged [debug | info | warning].")
|
||||
, "sets the level at which events are logged [debug | info | warning | fatal].")
|
||||
("ip-filter,f", po::value<std::string>(&ip_filter_file)->default_value("")
|
||||
, "sets the path to the ip-filter file used to block access from certain "
|
||||
"ips. ")
|
||||
|
@ -525,6 +525,8 @@ int main(int ac, char* av[])
|
|||
ses.set_severity_level(alert::debug);
|
||||
else if (log_level == "warning")
|
||||
ses.set_severity_level(alert::warning);
|
||||
else if (log_level == "fatal")
|
||||
ses.set_severity_level(alert::fatal);
|
||||
else
|
||||
ses.set_severity_level(alert::info);
|
||||
|
||||
|
|
|
@ -932,6 +932,8 @@ namespace libtorrent
|
|||
, m_peers.end()
|
||||
, match_peer_ip(remote));
|
||||
|
||||
bool just_added = false;
|
||||
|
||||
if (i == m_peers.end())
|
||||
{
|
||||
using namespace boost::posix_time;
|
||||
|
@ -944,6 +946,7 @@ namespace libtorrent
|
|||
// the iterator is invalid
|
||||
// because of the push_back()
|
||||
i = m_peers.end() - 1;
|
||||
just_added = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -975,7 +978,14 @@ namespace libtorrent
|
|||
if (m_torrent->num_peers() < m_torrent->m_connections_quota.given
|
||||
&& !m_torrent->is_paused())
|
||||
{
|
||||
connect_peer(&*i);
|
||||
if (!connect_peer(&*i) && just_added)
|
||||
{
|
||||
// if this peer was just added, and it
|
||||
// failed to connect. Remove it from the list
|
||||
// (to keep it in sync with the session's list)
|
||||
assert(i == m_peers.end() - 1);
|
||||
m_peers.erase(i);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1175,10 +1185,10 @@ namespace libtorrent
|
|||
catch (network_error& e)
|
||||
{
|
||||
// TODO: This path needs testing!
|
||||
std::string msg = e.what();
|
||||
assert(false);
|
||||
// TODO: remove the peer
|
||||
// m_peers.erase(std::find(m_peers.begin(), m_peers.end(), p));
|
||||
#if defined(TORRENT_VERBOSE_LOGGING)
|
||||
std::string msg = e.what();
|
||||
(*p->connection->m_logger) << "*** CONNECTION FAILED '" << msg << "'\n";
|
||||
#endif
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1090,12 +1090,14 @@ namespace libtorrent { namespace detail
|
|||
i != m_half_open.end(); ++i)
|
||||
{
|
||||
assert(i->second->is_connecting());
|
||||
assert(m_selector.is_writability_monitored(i->second->get_socket()));
|
||||
}
|
||||
|
||||
for (connection_map::iterator i = m_connections.begin();
|
||||
i != m_connections.end(); ++i)
|
||||
{
|
||||
assert(i->second);
|
||||
assert(!i->second->is_connecting());
|
||||
if (i->second->is_connecting()
|
||||
|| i->second->can_write() != m_selector.is_writability_monitored(i->first)
|
||||
|| i->second->can_read() != m_selector.is_readability_monitored(i->first))
|
||||
|
|
Loading…
Reference in New Issue