]> granicus.if.org Git - transmission/commitdiff
(trunk libT) #4070 "assertion failure happens soon after startup" -- fixed.
authorJordan Lee <jordan@transmissionbt.com>
Thu, 3 Mar 2011 17:28:04 +0000 (17:28 +0000)
committerJordan Lee <jordan@transmissionbt.com>
Thu, 3 Mar 2011 17:28:04 +0000 (17:28 +0000)
Thanks to User294 for helping to track down the problem.

libtransmission/peer-mgr.c

index df2156a7fb89f9812dcd27c97e6bf93697645189..e8bff23c1e8b4223ab2e619bdfa40a4c88244228 100644 (file)
@@ -1608,7 +1608,6 @@ peerCallbackFunc( tr_peer * peer, const tr_peer_event * e, void * vt )
     torrentLock( t );
 
     assert( peer != NULL );
-    assert( peer->atom != NULL );
 
     switch( e->eventType )
     {
@@ -1630,7 +1629,7 @@ peerCallbackFunc( tr_peer * peer, const tr_peer_event * e, void * vt )
                 tr_statsAddUploaded( tor->session, e->length );
 
             /* update our atom */
-            if( e->wasPieceData )
+            if( peer->atom && e->wasPieceData )
                 peer->atom->piece_data_time = now;
 
             break;
@@ -1671,7 +1670,8 @@ peerCallbackFunc( tr_peer * peer, const tr_peer_event * e, void * vt )
             break;
 
         case TR_PEER_CLIENT_GOT_PORT:
-            peer->atom->port = e->port;
+            if( peer->atom )
+                peer->atom->port = e->port;
             break;
 
         case TR_PEER_CLIENT_GOT_SUGGEST:
@@ -1699,7 +1699,7 @@ peerCallbackFunc( tr_peer * peer, const tr_peer_event * e, void * vt )
                 tr_statsAddDownloaded( tor->session, e->length );
 
             /* update our atom */
-            if( e->wasPieceData )
+            if( peer->atom && e->wasPieceData )
                 peer->atom->piece_data_time = now;
 
             break;