mirror of
https://github.com/transmission/transmission
synced 2024-12-24 00:34:04 +00:00
(trunk, libT) #5063 'remaining time unknown with magnets that have webseeds' -- fixed.
This commit is contained in:
parent
682d257808
commit
ebd4b5e386
1 changed files with 27 additions and 9 deletions
|
@ -508,10 +508,27 @@ torrentFree( void * vt )
|
||||||
|
|
||||||
static void peerCallbackFunc( tr_peer *, const tr_peer_event *, void * );
|
static void peerCallbackFunc( tr_peer *, const tr_peer_event *, void * );
|
||||||
|
|
||||||
|
static void
|
||||||
|
rebuildWebseedArray( Torrent * t, tr_torrent * tor )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
const tr_info * inf = &tor->info;
|
||||||
|
|
||||||
|
/* clear the array */
|
||||||
|
tr_ptrArrayDestruct( &t->webseeds, (PtrArrayForeachFunc)tr_webseedFree );
|
||||||
|
t->webseeds = TR_PTR_ARRAY_INIT;
|
||||||
|
|
||||||
|
/* repopulate it */
|
||||||
|
for( i = 0; i < inf->webseedCount; ++i )
|
||||||
|
{
|
||||||
|
tr_webseed * w = tr_webseedNew( tor, inf->webseeds[i], peerCallbackFunc, t );
|
||||||
|
tr_ptrArrayAppend( &t->webseeds, w );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static Torrent*
|
static Torrent*
|
||||||
torrentNew( tr_peerMgr * manager, tr_torrent * tor )
|
torrentNew( tr_peerMgr * manager, tr_torrent * tor )
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
Torrent * t;
|
Torrent * t;
|
||||||
|
|
||||||
t = tr_new0( Torrent, 1 );
|
t = tr_new0( Torrent, 1 );
|
||||||
|
@ -522,12 +539,7 @@ torrentNew( tr_peerMgr * manager, tr_torrent * tor )
|
||||||
t->webseeds = TR_PTR_ARRAY_INIT;
|
t->webseeds = TR_PTR_ARRAY_INIT;
|
||||||
t->outgoingHandshakes = TR_PTR_ARRAY_INIT;
|
t->outgoingHandshakes = TR_PTR_ARRAY_INIT;
|
||||||
|
|
||||||
for( i = 0; i < tor->info.webseedCount; ++i )
|
rebuildWebseedArray( t, tor );
|
||||||
{
|
|
||||||
tr_webseed * w =
|
|
||||||
tr_webseedNew( tor, tor->info.webseeds[i], peerCallbackFunc, t );
|
|
||||||
tr_ptrArrayAppend( &t->webseeds, w );
|
|
||||||
}
|
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
@ -2517,13 +2529,19 @@ void
|
||||||
tr_peerMgrOnTorrentGotMetainfo( tr_torrent * tor )
|
tr_peerMgrOnTorrentGotMetainfo( tr_torrent * tor )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
const int peerCount = tr_ptrArraySize( &tor->torrentPeers->peers );
|
int peerCount;
|
||||||
tr_peer ** peers = (tr_peer**) tr_ptrArrayBase( &tor->torrentPeers->peers );
|
tr_peer ** peers;
|
||||||
|
|
||||||
|
/* the webseed list may have changed... */
|
||||||
|
rebuildWebseedArray( tor->torrentPeers, tor );
|
||||||
|
|
||||||
/* some peer_msgs' progress fields may not be accurate if we
|
/* some peer_msgs' progress fields may not be accurate if we
|
||||||
didn't have the metadata before now... so refresh them all... */
|
didn't have the metadata before now... so refresh them all... */
|
||||||
|
peerCount = tr_ptrArraySize( &tor->torrentPeers->peers );
|
||||||
|
peers = (tr_peer**) tr_ptrArrayBase( &tor->torrentPeers->peers );
|
||||||
for( i=0; i<peerCount; ++i )
|
for( i=0; i<peerCount; ++i )
|
||||||
tr_peerUpdateProgress( tor, peers[i] );
|
tr_peerUpdateProgress( tor, peers[i] );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue