1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 01:27:28 +00:00

(libT) #1417: overhead should be counted in the global stats

This commit is contained in:
Charles Kerr 2008-11-04 17:37:51 +00:00
parent b4d5883c17
commit 9859578a7d
3 changed files with 10 additions and 10 deletions

View file

@ -30,6 +30,7 @@
#include "net.h"
#include "peer-io.h"
#include "ratecontrol.h"
#include "stats.h" /* tr_statsAddUploaded(), tr_statsAddDownloaded() */
#include "trevent.h"
#include "utils.h"
@ -181,6 +182,7 @@ didWriteWrapper( struct bufferevent * e,
b->bytesLeft -= MIN( b->bytesLeft, (size_t)n );
b->bytesUsed += n;
tr_rcTransferred( io->speedometer[TR_UP], n );
tr_statsAddUploaded( io->session, n );
dbgmsg( io,
"wrote %zu bytes to peer... upload bytesLeft is now %zu",
n,
@ -213,6 +215,7 @@ canReadWrapper( struct bufferevent * e,
b->bytesLeft -= MIN( b->bytesLeft, (size_t)n );
b->bytesUsed += n;
tr_rcTransferred( io->speedometer[TR_DOWN], n );
tr_statsAddDownloaded( io->session, n );
dbgmsg( io,
"%zu new input bytes. bytesUsed is %zu, bytesLeft is %zu",
n, b->bytesUsed,

View file

@ -31,7 +31,6 @@
#include "peer-mgr-private.h"
#include "peer-msgs.h"
#include "ptrarray.h"
#include "stats.h" /* tr_statsAddDownloaded */
#include "torrent.h"
#include "trevent.h"
#include "utils.h"
@ -1008,7 +1007,6 @@ peerCallbackFunc( void * vpeer,
tr_torrent * tor = t->tor;
tor->activityDate = now;
tor->uploadedCur += e->length;
tr_statsAddUploaded( tor->session, e->length );
if( peer )
{
struct peer_atom * a = getExistingAtom( t, &peer->in_addr );
@ -1030,7 +1028,6 @@ peerCallbackFunc( void * vpeer,
* into the jurisdiction of the tracker." */
if( peer )
tor->downloadedCur += e->length;
tr_statsAddDownloaded( tor->session, e->length );
if( peer ) {
struct peer_atom * a = getExistingAtom( t, &peer->in_addr );
a->piece_data_time = now;

View file

@ -13,16 +13,16 @@
#ifndef TR_STATS_H
#define TR_STATS_H
void tr_statsInit( tr_handle * handle );
void tr_statsInit ( tr_session * session );
void tr_statsClose( tr_handle * handle );
void tr_statsClose ( tr_session * session );
void tr_statsAddUploaded( tr_handle * handle,
uint32_t bytes );
void tr_statsAddUploaded ( tr_session * session,
uint32_t bytes );
void tr_statsAddDownloaded( tr_handle * handle,
uint32_t bytes );
void tr_statsAddDownloaded ( tr_session * session,
uint32_t bytes );
void tr_statsFileCreated( tr_handle * handle );
void tr_statsFileCreated ( tr_session * session );
#endif