mirror of
https://github.com/transmission/transmission
synced 2024-12-26 17:47:37 +00:00
(trunk libT) #2711 "no metadata exchange when using magnet links and trackerless torrents" -- fixed
This commit is contained in:
parent
c26c0deed9
commit
a5446669b4
1 changed files with 17 additions and 8 deletions
|
@ -690,8 +690,9 @@ torrentInit( tr_torrent * tor, const tr_ctor * ctor )
|
||||||
tr_sessionUnlock( session );
|
tr_sessionUnlock( session );
|
||||||
}
|
}
|
||||||
|
|
||||||
tr_parse_result
|
static tr_parse_result
|
||||||
tr_torrentParse( const tr_ctor * ctor, tr_info * setmeInfo )
|
torrentParseImpl( const tr_ctor * ctor, tr_info * setmeInfo,
|
||||||
|
int * dictOffset, int * dictLength )
|
||||||
{
|
{
|
||||||
int doFree;
|
int doFree;
|
||||||
tr_bool didParse;
|
tr_bool didParse;
|
||||||
|
@ -707,7 +708,7 @@ tr_torrentParse( const tr_ctor * ctor, tr_info * setmeInfo )
|
||||||
if( tr_ctorGetMetainfo( ctor, &metainfo ) )
|
if( tr_ctorGetMetainfo( ctor, &metainfo ) )
|
||||||
return TR_PARSE_ERR;
|
return TR_PARSE_ERR;
|
||||||
|
|
||||||
didParse = tr_metainfoParse( session, setmeInfo, NULL, NULL, metainfo );
|
didParse = tr_metainfoParse( session, setmeInfo, dictOffset, dictLength, metainfo );
|
||||||
doFree = didParse && ( setmeInfo == &tmp );
|
doFree = didParse && ( setmeInfo == &tmp );
|
||||||
|
|
||||||
if( !didParse )
|
if( !didParse )
|
||||||
|
@ -725,9 +726,14 @@ tr_torrentParse( const tr_ctor * ctor, tr_info * setmeInfo )
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tr_parse_result
|
||||||
|
tr_torrentParse( const tr_ctor * ctor, tr_info * setmeInfo )
|
||||||
|
{
|
||||||
|
return torrentParseImpl( ctor, setmeInfo, NULL, NULL );
|
||||||
|
}
|
||||||
|
|
||||||
tr_torrent *
|
tr_torrent *
|
||||||
tr_torrentNew( const tr_ctor * ctor,
|
tr_torrentNew( const tr_ctor * ctor, int * setmeError )
|
||||||
int * setmeError )
|
|
||||||
{
|
{
|
||||||
tr_info tmpInfo;
|
tr_info tmpInfo;
|
||||||
tr_torrent * tor = NULL;
|
tr_torrent * tor = NULL;
|
||||||
|
@ -753,16 +759,19 @@ tr_torrentNew( const tr_ctor * ctor,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const int err = tr_torrentParse( ctor, &tmpInfo );
|
int off, len;
|
||||||
if( !err )
|
tr_parse_result r = torrentParseImpl( ctor, &tmpInfo, &off, &len );
|
||||||
|
if( r == TR_PARSE_OK )
|
||||||
{
|
{
|
||||||
tor = tr_new0( tr_torrent, 1 );
|
tor = tr_new0( tr_torrent, 1 );
|
||||||
tor->info = tmpInfo;
|
tor->info = tmpInfo;
|
||||||
|
tor->infoDictOffset = off;
|
||||||
|
tor->infoDictLength = len;
|
||||||
torrentInit( tor, ctor );
|
torrentInit( tor, ctor );
|
||||||
}
|
}
|
||||||
else if( setmeError )
|
else if( setmeError )
|
||||||
{
|
{
|
||||||
*setmeError = err;
|
*setmeError = r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue