1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-24 08:43:27 +00:00

Removed now unused tables and some now unused code

This commit is contained in:
Eric Petit 2006-01-30 02:13:40 +00:00
parent 58ec7a7e97
commit 28d43da1d1
5 changed files with 18 additions and 39 deletions

View file

@ -146,9 +146,9 @@ struct tr_torrent_s
int peerCount;
tr_peer_t * peers[TR_MAX_PEER_COUNT];
uint64_t dates[10];
uint64_t downloaded[10];
uint64_t uploaded[10];
uint64_t date;
uint64_t downloaded;
uint64_t uploaded;
};
#include "utils.h"

View file

@ -244,7 +244,7 @@ int tr_peerRead( tr_torrent_t * tor, tr_peer_t * peer )
{
tr_rcTransferred( tor->download, ret );
tr_rcTransferred( tor->globalDownload, ret );
if( parseBuf( tor, peer, ret ) )
if( parseBuf( tor, peer ) )
{
return 1;
}
@ -282,15 +282,9 @@ void tr_peerPulse( tr_torrent_t * tor )
uint8_t * p;
tr_peer_t * peer;
tor->dates[9] = tr_date();
if( tor->dates[9] > tor->dates[8] + 1000 )
if( tr_date() > tor->date + 1000 )
{
memmove( &tor->downloaded[0], &tor->downloaded[1],
9 * sizeof( uint64_t ) );
memmove( &tor->uploaded[0], &tor->uploaded[1],
9 * sizeof( uint64_t ) );
memmove( &tor->dates[0], &tor->dates[1],
9 * sizeof( uint64_t ) );
tor->date = tr_date();
for( i = 0; i < tor->peerCount; )
{
@ -379,9 +373,9 @@ writeBegin:
tr_rcTransferred( tor->upload, ret );
tr_rcTransferred( tor->globalUpload, ret );
tor->uploaded[9] += ret;
peer->outTotal += ret;
peer->outDate = tr_date();
tor->uploaded += ret;
peer->outTotal += ret;
peer->outDate = tr_date();
/* In case this block is done, you may have messages
pending. Send them before we start the next block */

View file

@ -268,6 +268,8 @@ static inline int parsePiece( tr_torrent_t * tor, tr_peer_t * peer,
return 1;
}
tor->downloaded += r->length;
block = tr_block( r->index, r->begin );
if( tr_cpBlockIsComplete( tor->completion, block ) )
{
@ -438,8 +440,7 @@ static uint8_t * parseBufHash( tr_peer_t * peer )
}
}
static inline int parseBuf( tr_torrent_t * tor, tr_peer_t * peer,
int newBytes )
static inline int parseBuf( tr_torrent_t * tor, tr_peer_t * peer )
{
tr_info_t * inf = &tor->info;
@ -523,15 +524,6 @@ static inline int parseBuf( tr_torrent_t * tor, tr_peer_t * peer,
continue;
}
/* That's a piece coming */
if( p < end && *p == 7 )
{
/* XXX */
tor->downloaded[9] += newBytes;
peer->inTotal += newBytes;
newBytes = 0;
}
if( &p[len] > end )
{
/* We do not have the entire message */

View file

@ -282,7 +282,7 @@ static void sendQuery( tr_tracker_t * tc )
"User-Agent: Transmission/%d.%d\r\n"
"Connection: close\r\n\r\n",
inf->trackerAnnounce, tor->hashString, tc->id,
tc->bindPort, tor->uploaded[9], tor->downloaded[9],
tc->bindPort, tor->uploaded, tor->downloaded,
left, tor->key, event, inf->trackerAddress,
VERSION_MAJOR, VERSION_MINOR );

View file

@ -278,8 +278,6 @@ char * tr_torrentGetFolder( tr_handle_t * h, int t )
void tr_torrentStart( tr_handle_t * h, int t )
{
tr_torrent_t * tor = h->torrents[t];
uint64_t now;
int i;
if( tor->status & ( TR_STATUS_STOPPING | TR_STATUS_STOPPED ) )
{
@ -290,12 +288,7 @@ void tr_torrentStart( tr_handle_t * h, int t )
tor->status = TR_STATUS_CHECK;
tor->tracker = tr_trackerInit( h, tor );
now = tr_date();
for( i = 0; i < 10; i++ )
{
tor->dates[i] = now;
}
tor->date = tr_date();
tor->die = 0;
tr_threadCreate( &tor->thread, downloadLoop, tor );
}
@ -331,8 +324,8 @@ static void torrentReallyStop( tr_handle_t * h, int t )
tr_peerRem( tor, 0 );
}
memset( tor->downloaded, 0, sizeof( tor->downloaded ) );
memset( tor->uploaded, 0, sizeof( tor->uploaded ) );
tor->downloaded = 0;
tor->uploaded = 0;
}
/***********************************************************************
@ -451,8 +444,8 @@ int tr_torrentStat( tr_handle_t * h, tr_stat_t ** stat )
}
}
s[i].downloaded = tor->downloaded[9];
s[i].uploaded = tor->uploaded[9];
s[i].downloaded = tor->downloaded;
s[i].uploaded = tor->uploaded;
s[i].folder = tor->destination;