This commit is contained in:
Charles Kerr 2008-08-09 16:17:59 +00:00
parent 4855db0d6d
commit 58fb922ac1
1 changed files with 6 additions and 1 deletions

View File

@ -1078,7 +1078,10 @@ tr_peerMgrCompactToPex( const void * compact,
size_t i;
size_t n = compactLen / 6;
const uint8_t * walk = compact;
const size_t flen = strlen( added_f );
tr_pex * pex = tr_new0( tr_pex, n );
#if 0
if( added_f && strlen(added_f)!=n )
{
int i;
@ -1087,10 +1090,12 @@ if( added_f && strlen(added_f)!=n )
for( i=0; i<len; ++i )
fprintf( stderr, "added.f[%d] is %d\n", i, (int)added_f[i] );
}
#endif
for( i=0; i<n; ++i ) {
memcpy( &pex[i].in_addr, walk, 4 ); walk += 4;
memcpy( &pex[i].port, walk, 2 ); walk += 2;
if( added_f )
if( added_f && ( n == flen ) )
pex[i].flags = added_f[i];
}
*pexCount = n;