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;
}
if (ec2)
{
i->second.connection->disconnect(ec2.message().c_str());
}
if (self_connection)
{
c.disconnect("connected to ourselves", 1);
@ -650,7 +645,11 @@ namespace libtorrent
TORRENT_ASSERT(i->second.connection != &c);
// the new connection is a local (outgoing) connection
// 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");
return false;