]> granicus.if.org Git - transmission/commitdiff
(trunk libT) closeBadPeers() part 2 of 2: this function was serving two purposes...
authorJordan Lee <jordan@transmissionbt.com>
Sat, 19 Feb 2011 12:30:18 +0000 (12:30 +0000)
committerJordan Lee <jordan@transmissionbt.com>
Sat, 19 Feb 2011 12:30:18 +0000 (12:30 +0000)
libtransmission/peer-mgr.c

index 19e7c668be14c3b1c7836aa915261e4bbb0a3ead..c44065fed25b8ba70c98b859e5ff3d8f3c678b83 100644 (file)
@@ -3270,22 +3270,12 @@ removeAllPeers( Torrent * t )
 static void
 closeBadPeers( Torrent * t, const time_t now_sec )
 {
-    if( !t->isRunning )
-    {
-        removeAllPeers( t );
-    }
-    else
-    {
-        int i;
-        int mustCloseCount;
-        struct tr_peer ** mustClose;
-
-        /* disconnect the really bad peers */
-        mustClose = getPeersToClose( t, TR_MUST_CLOSE, now_sec, &mustCloseCount );
-        for( i=0; i<mustCloseCount; ++i )
-            closePeer( t, mustClose[i] );
-        tr_free( mustClose );
-    }
+    int i;
+    int mustCloseCount;
+    struct tr_peer ** mustClose = getPeersToClose( t, TR_MUST_CLOSE, now_sec, &mustCloseCount );
+    for( i=0; i<mustCloseCount; ++i )
+        closePeer( t, mustClose[i] );
+    tr_free( mustClose );
 }
 
 struct peer_liveliness
@@ -3454,7 +3444,10 @@ reconnectPulse( int foo UNUSED, short bar UNUSED, void * vmgr )
     /* remove crappy peers */
     tor = NULL;
     while(( tor = tr_torrentNext( mgr->session, tor )))
-        closeBadPeers( tor->torrentPeers, now_sec );
+        if( !tor->torrentPeers->isRunning )
+            removeAllPeers( tor->torrentPeers );
+        else
+            closeBadPeers( tor->torrentPeers, now_sec );
 
     /* try to make new peer connections */
     makeNewPeerConnections( mgr, MAX_CONNECTIONS_PER_PULSE );