mirror of
https://github.com/transmission/transmission
synced 2025-03-15 16:29:34 +00:00
(trunk libT) #2722 "crash when removing/modifying trackers" -- fixed
This commit is contained in:
parent
6f68e30f37
commit
59c10a3dc8
2 changed files with 10 additions and 4 deletions
|
@ -1697,6 +1697,7 @@ static void
|
|||
onUpkeepTimer( int foo UNUSED, short bar UNUSED, void * vannouncer )
|
||||
{
|
||||
tr_announcer * announcer = vannouncer;
|
||||
tr_sessionLock( announcer->session );
|
||||
|
||||
/* maybe send out some "stopped" messages for closed torrents */
|
||||
flushCloseMessages( announcer );
|
||||
|
@ -1706,6 +1707,8 @@ onUpkeepTimer( int foo UNUSED, short bar UNUSED, void * vannouncer )
|
|||
|
||||
/* set up the next timer */
|
||||
tr_timerAdd( announcer->upkeepTimer, UPKEEP_INTERVAL_SECS, 0 );
|
||||
|
||||
tr_sessionUnlock( announcer->session );
|
||||
}
|
||||
|
||||
/***
|
||||
|
|
|
@ -2089,16 +2089,18 @@ tr_torrentSetAnnounceList( tr_torrent * tor,
|
|||
{
|
||||
int i;
|
||||
tr_benc metainfo;
|
||||
tr_bool ok = TRUE;
|
||||
tr_torrentLock( tor );
|
||||
|
||||
assert( tr_isTorrent( tor ) );
|
||||
|
||||
/* look for bad URLs */
|
||||
for( i=0; i<trackerCount; ++i )
|
||||
for( i=0; ok && i<trackerCount; ++i )
|
||||
if( !tr_httpIsValidURL( trackers[i].announce ) )
|
||||
return TR_ANNOUNCE_LIST_HAS_BAD;
|
||||
ok = FALSE;
|
||||
|
||||
/* save to the .torrent file */
|
||||
if( !tr_bencLoadFile( &metainfo, TR_FMT_BENC, tor->info.torrent ) )
|
||||
if( ok && !tr_bencLoadFile( &metainfo, TR_FMT_BENC, tor->info.torrent ) )
|
||||
{
|
||||
tr_info tmpInfo;
|
||||
|
||||
|
@ -2155,7 +2157,8 @@ tr_torrentSetAnnounceList( tr_torrent * tor,
|
|||
tr_announcerResetTorrent( tor->session->announcer, tor );
|
||||
}
|
||||
|
||||
return TR_ANNOUNCE_LIST_OK;
|
||||
tr_torrentUnlock( tor );
|
||||
return ok ? TR_ANNOUNCE_LIST_OK : TR_ANNOUNCE_LIST_HAS_BAD;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue