libT now stores peer upload rate

This commit is contained in:
Mitchell Livingston 2006-12-18 04:56:27 +00:00
parent 8eb2ec59c2
commit 718a39cd16
2 changed files with 9 additions and 0 deletions

View File

@ -100,6 +100,7 @@ struct tr_peer_s
int outSlow;
tr_ratecontrol_t * download;
tr_ratecontrol_t * upload;
};
#define peer_dbg( a... ) __peer_dbg( peer, ## a )
@ -223,6 +224,7 @@ void tr_peerDestroy( tr_fd_t * fdlimit, tr_peer_t * peer )
tr_fdSocketClosed( fdlimit, 0 );
}
tr_rcClose( peer->download );
tr_rcClose( peer->upload );
free( peer );
}
@ -450,6 +452,7 @@ writeBegin:
}
blockSent( peer, ret );
tr_rcTransferred( peer->upload, ret );
tr_rcTransferred( tor->upload, ret );
tr_rcTransferred( tor->globalUpload, ret );
@ -571,6 +574,11 @@ float tr_peerDownloadRate( tr_peer_t * peer )
return tr_rcRate( peer->download );
}
float tr_peerUploadRate( tr_peer_t * peer )
{
return tr_rcRate( peer->upload );
}
int tr_peerIsUnchoked( tr_peer_t * peer )
{
return !peer->amChoking;

View File

@ -47,6 +47,7 @@ float tr_peerProgress ( tr_peer_t * );
int tr_peerPort ( tr_peer_t * );
uint8_t * tr_peerBitfield ( tr_peer_t * );
float tr_peerDownloadRate ( tr_peer_t * );
float tr_peerUploadRate ( tr_peer_t * );
int tr_peerIsUnchoked ( tr_peer_t * );
int tr_peerIsInterested ( tr_peer_t * );
void tr_peerChoke ( tr_peer_t * );