fix bug in self connect detection

This commit is contained in:
Arvid Norberg 2008-06-18 13:31:41 +00:00
parent 7fe6c474ce
commit 18809681be
1 changed files with 5 additions and 6 deletions

View File

@ -635,11 +635,6 @@ namespace libtorrent
return false; return false;
} }
if (ec2)
{
i->second.connection->disconnect(ec2.message().c_str());
}
if (self_connection) if (self_connection)
{ {
c.disconnect("connected to ourselves", 1); c.disconnect("connected to ourselves", 1);
@ -650,7 +645,11 @@ namespace libtorrent
TORRENT_ASSERT(i->second.connection != &c); TORRENT_ASSERT(i->second.connection != &c);
// the new connection is a local (outgoing) connection // the new connection is a local (outgoing) connection
// or the current one is already connected // or the current one is already connected
if (!i->second.connection->is_connecting() || c.is_local()) if (ec2)
{
i->second.connection->disconnect(ec2.message().c_str());
}
else if (!i->second.connection->is_connecting() || c.is_local())
{ {
c.disconnect("duplicate connection, closing"); c.disconnect("duplicate connection, closing");
return false; return false;