fix John_Clay's tracker assertion failure.

This commit is contained in:
Charles Kerr 2007-09-28 16:14:19 +00:00
parent 92923a0236
commit 198d2c256e
2 changed files with 7 additions and 6 deletions

View File

@ -1110,7 +1110,9 @@ sendBitfield( tr_peermsgs * msgs )
***
**/
#define MAX_DIFFS 50
/* some peers give us error messages if we send
more than this many peers in a single pex message */
#define MAX_PEX_DIFFS 50
typedef struct
{
@ -1129,7 +1131,7 @@ pexAddedCb( void * vpex, void * userData )
{
PexDiffs * diffs = (PexDiffs *) userData;
tr_pex * pex = (tr_pex *) vpex;
if( diffs->diffCount < MAX_DIFFS )
if( diffs->diffCount < MAX_PEX_DIFFS )
{
diffs->diffCount++;
diffs->added[diffs->addedCount++] = *pex;
@ -1142,7 +1144,7 @@ pexRemovedCb( void * vpex, void * userData )
{
PexDiffs * diffs = (PexDiffs *) userData;
tr_pex * pex = (tr_pex *) vpex;
if( diffs->diffCount < MAX_DIFFS )
if( diffs->diffCount < MAX_PEX_DIFFS )
{
diffs->diffCount++;
diffs->dropped[diffs->droppedCount++] = *pex;
@ -1154,7 +1156,7 @@ pexElementCb( void * vpex, void * userData )
{
PexDiffs * diffs = (PexDiffs *) userData;
tr_pex * pex = (tr_pex *) vpex;
if( diffs->diffCount < MAX_DIFFS )
if( diffs->diffCount < MAX_PEX_DIFFS )
{
diffs->diffCount++;
diffs->elements[diffs->elementCount++] = *pex;

View File

@ -620,10 +620,9 @@ onScrapeResponse( struct evhttp_request * req, void * vt )
if(( tmp = tr_bencDictFind( flags, "min_request_interval")))
t->scrapeIntervalMsec = tmp->val.i * 1000;
assert( tr_ptrArrayFindSorted(t->scraping,tor,torrentCompare) ); /* FIXME This is the line that crashes for John_Clay */
tr_ptrArrayRemoveSorted( t->scraping, tor, torrentCompare );
assert( !tor->scrapeTimer );
tr_timerFree( &tor->scrapeTimer );
tor->scrapeTimer = tr_timerNew( t->handle, onTorrentScrapeNow, tor, t->scrapeIntervalMsec );
tr_dbg( "Torrent '%s' scrape successful."
" Rescraping in %d seconds",