changes to message logging: (1) bring back "Torrent hasn't responded yet", but only in the message log. (2) make PEX messages debug. (3) log a message when a torrent reaches completion.
This commit is contained in:
parent
913f2843b2
commit
05c6938f5a
|
@ -974,7 +974,7 @@ parseUtPex( tr_peermsgs * msgs, int msglen, struct evbuffer * inbuf )
|
|||
{
|
||||
const int n = sub->val.s.i / 6 ;
|
||||
if( n )
|
||||
tr_torinf( tor, _( "Got %d peers from peer exchange" ), n );
|
||||
tr_tordbg( tor, _( "Got %d peers from peer exchange" ), n );
|
||||
tr_peerMgrAddPeers( msgs->handle->peerMgr,
|
||||
tor->info.hash,
|
||||
TR_PEER_FROM_PEX,
|
||||
|
|
|
@ -1047,6 +1047,17 @@ tr_torrentDelete( tr_torrent * tor )
|
|||
*** Completeness
|
||||
**/
|
||||
|
||||
static const char *
|
||||
getCompletionString( int type )
|
||||
{
|
||||
switch( type )
|
||||
{
|
||||
case TR_CP_DONE: return _( "Done" );
|
||||
case TR_CP_COMPLETE: return _( "Complete" );
|
||||
default: return _( "Incomplete" );
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
fireStatusChange( tr_torrent * tor, cp_status_t status )
|
||||
{
|
||||
|
@ -1081,15 +1092,27 @@ tr_torrentRecheckCompleteness( tr_torrent * tor )
|
|||
tr_torrentLock( tor );
|
||||
|
||||
cpStatus = tr_cpGetStatus( tor->completion );
|
||||
if( cpStatus != tor->cpStatus ) {
|
||||
|
||||
if( cpStatus != tor->cpStatus )
|
||||
{
|
||||
const int recentChange = tor->downloadedCur != 0;
|
||||
|
||||
if( recentChange )
|
||||
{
|
||||
tr_torinf( tor, _( "State changed from \"%s\" to \"%s\"" ),
|
||||
getCompletionString( tor->cpStatus ),
|
||||
getCompletionString( cpStatus ) );
|
||||
}
|
||||
|
||||
tor->cpStatus = cpStatus;
|
||||
fireStatusChange( tor, cpStatus );
|
||||
if( (cpStatus == TR_CP_COMPLETE) /* ...and if we're complete */
|
||||
&& tor->downloadedCur ) { /* and it just happened */
|
||||
tr_trackerCompleted( tor->tracker ); /* tell the tracker */
|
||||
}
|
||||
|
||||
if( recentChange && ( cpStatus == TR_CP_COMPLETE ) )
|
||||
tr_trackerCompleted( tor->tracker );
|
||||
|
||||
saveFastResumeNow( tor );
|
||||
}
|
||||
|
||||
tr_torrentUnlock( tor );
|
||||
}
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ myDebug( const char * file, int line, const tr_tracker * t, const char * fmt, ..
|
|||
****
|
||||
***/
|
||||
|
||||
static tr_tracker_info *
|
||||
static const tr_tracker_info *
|
||||
getCurrentAddress( const tr_tracker * t )
|
||||
{
|
||||
assert( t->addresses != NULL );
|
||||
|
@ -295,6 +295,7 @@ updateAddresses( tr_tracker * t, const struct evhttp_request * req, int * tryAga
|
|||
|
||||
if( !req ) /* tracker didn't respond */
|
||||
{
|
||||
tr_ninf( t->name, _( "Tracker hasn't responded yet. Retrying..." ) );
|
||||
moveToNextAddress = TRUE;
|
||||
}
|
||||
else if( req->response_code == HTTP_OK )
|
||||
|
@ -348,6 +349,11 @@ updateAddresses( tr_tracker * t, const struct evhttp_request * req, int * tryAga
|
|||
*tryAgain = FALSE;
|
||||
t->addressIndex = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
const tr_tracker_info * n = getCurrentAddress( t );
|
||||
tr_ninf( t->name, _( "Trying next tracker \"%s:%d\"" ), n->address, n->port );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -684,7 +690,7 @@ buildTrackerRequestURI( const tr_tracker * t,
|
|||
struct evbuffer * buf = evbuffer_new( );
|
||||
char * ret;
|
||||
|
||||
char * ann = getCurrentAddress(t)->announce;
|
||||
const char * ann = getCurrentAddress(t)->announce;
|
||||
|
||||
evbuffer_add_printf( buf, "%s"
|
||||
"%cinfo_hash=%s"
|
||||
|
|
Loading…
Reference in New Issue