fix looooong-standing bug that choked tracker connections

This commit is contained in:
Charles Kerr 2007-07-21 17:35:47 +00:00
parent c7beebd1eb
commit 1d932b07c7
2 changed files with 11 additions and 8 deletions

View File

@ -329,14 +329,14 @@ int tr_fdSocketCreate( int type, int priority )
int s = -1;
tr_lockLock( &gFd->lock );
if( ( priority && gFd->reserved < TR_RESERVED_FDS ) ||
( !priority && gFd->normal < gFd->normalMax ) )
{
if( priority && gFd->reserved >= TR_RESERVED_FDS )
priority = FALSE;
if( priority || ( gFd->normal < gFd->normalMax ) )
if( ( s = socket( AF_INET, type, 0 ) ) < 0 )
{
tr_err( "Could not create socket (%s)", strerror( errno ) );
}
}
if( s > -1 )
{
SocketSetPriority( s, priority );

View File

@ -969,10 +969,13 @@ tr_torrentFree( tr_torrent_t * tor )
}
}
tr_free( tor );
h->torrentCount--;
fprintf(stderr, "closing torrent %s... %d torrents left",
tor->info.name, h->torrentCount );
tr_free( tor );
tr_sharedUnlock( h->shared );
}