mirror of https://github.com/aria2/aria2
				
				
				
			To fix the bug that causes the number of bytes uploaded is not
saved to .aria2 file: * src/DefaultPeerStorage.h (removedPeerSessionDownloadLength): New variable. (removedPeerSessionUploadLength): New variable. * src/DefaultPeerStorage.cc (DefaultPieceStorage): Added removedPeerSessionDownloadLength(0), removedPeerSessionUploadLength(0). (calculateStat): Calculate the number of bytes downloaded(uploaded) through all peers, and then add removedPeerSessionDownloadLength( removedPeerSessionUploadLength) to it. (deleteUnusedPeer): Add the number of bytes downloaded(uploaded) from (to) the peer to removedPeerSessionDownloadLength (removedPeerSessionUploadLength).pull/1/head
							parent
							
								
									9b48e350c6
								
							
						
					
					
						commit
						b14e4a5ac1
					
				
							
								
								
									
										21
									
								
								ChangeLog
								
								
								
								
							
							
						
						
									
										21
									
								
								ChangeLog
								
								
								
								
							| 
						 | 
				
			
			@ -35,6 +35,27 @@
 | 
			
		|||
	* src/UrlRequestInfo.cc:
 | 
			
		||||
	setSignalHander -> Util::setGlobalSignalHandler
 | 
			
		||||
 | 
			
		||||
	Reset peer status in order to exit gracefully:
 | 
			
		||||
 | 
			
		||||
	* src/PeerAbstractCommand.cc
 | 
			
		||||
	(execute): Call peer->resetStatus() when btRuntime->isHalt() is true.
 | 
			
		||||
 | 
			
		||||
	To fix the bug that causes the number of bytes uploaded is not saved
 | 
			
		||||
	to .aria2 file:
 | 
			
		||||
 | 
			
		||||
	* src/DefaultPeerStorage.h
 | 
			
		||||
	(removedPeerSessionDownloadLength): New variable.
 | 
			
		||||
	(removedPeerSessionUploadLength): New variable.
 | 
			
		||||
	* src/DefaultPeerStorage.cc
 | 
			
		||||
	(DefaultPieceStorage): Added removedPeerSessionDownloadLength(0),
 | 
			
		||||
	removedPeerSessionUploadLength(0).
 | 
			
		||||
	(calculateStat): Calculate the number of bytes downloaded(uploaded)
 | 
			
		||||
	through all peers, and then add removedPeerSessionDownloadLength(
 | 
			
		||||
	removedPeerSessionUploadLength) to it.
 | 
			
		||||
	(deleteUnusedPeer): Add the number of bytes downloaded(uploaded) from
 | 
			
		||||
	 (to) the peer to removedPeerSessionDownloadLength
 | 
			
		||||
	 (removedPeerSessionUploadLength).
 | 
			
		||||
	
 | 
			
		||||
2006-11-09  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 | 
			
		||||
 | 
			
		||||
	To add Metalink location option:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -44,7 +44,9 @@ DefaultPeerStorage::DefaultPeerStorage(BtContextHandle btContext,
 | 
			
		|||
  option(option),
 | 
			
		||||
  maxPeerListSize(MAX_PEER_LIST_SIZE),
 | 
			
		||||
  peerEntryIdCounter(0),
 | 
			
		||||
  btRuntime(BT_RUNTIME(btContext))
 | 
			
		||||
  btRuntime(BT_RUNTIME(btContext)),
 | 
			
		||||
  removedPeerSessionDownloadLength(0),
 | 
			
		||||
  removedPeerSessionUploadLength(0)
 | 
			
		||||
{
 | 
			
		||||
  logger = LogFactory::getInstance();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -154,9 +156,14 @@ TransferStat DefaultPeerStorage::calculateStat() {
 | 
			
		|||
    PeerHandle& peer = *itr;
 | 
			
		||||
    stat.downloadSpeed += peer->calculateDownloadSpeed();
 | 
			
		||||
    stat.uploadSpeed += peer->calculateUploadSpeed();
 | 
			
		||||
  }
 | 
			
		||||
  for(Peers::iterator itr = peers.begin(); itr != peers.end(); itr++) {
 | 
			
		||||
    PeerHandle& peer = *itr;
 | 
			
		||||
    stat.sessionDownloadLength += peer->getSessionDownloadLength();
 | 
			
		||||
    stat.sessionUploadLength += peer->getSessionUploadLength();
 | 
			
		||||
  }
 | 
			
		||||
  stat.sessionDownloadLength += removedPeerSessionDownloadLength;
 | 
			
		||||
  stat.sessionUploadLength += removedPeerSessionUploadLength;
 | 
			
		||||
  return stat;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -165,6 +172,9 @@ void DefaultPeerStorage::deleteUnusedPeer(int delSize) {
 | 
			
		|||
      itr != peers.end() && delSize > 0;) {
 | 
			
		||||
    const PeerHandle& p = *itr;
 | 
			
		||||
    if(p->cuid == 0) {
 | 
			
		||||
      // Update removedPeerSession******Length
 | 
			
		||||
      removedPeerSessionDownloadLength += p->getSessionDownloadLength();
 | 
			
		||||
      removedPeerSessionUploadLength += p->getSessionUploadLength();
 | 
			
		||||
      itr = peers.erase(itr);
 | 
			
		||||
      delSize--;
 | 
			
		||||
    } else {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -53,6 +53,8 @@ private:
 | 
			
		|||
  int peerEntryIdCounter;
 | 
			
		||||
  Logger* logger;
 | 
			
		||||
  BtRuntimeHandle btRuntime;
 | 
			
		||||
  long long int removedPeerSessionDownloadLength;
 | 
			
		||||
  long long int removedPeerSessionUploadLength;
 | 
			
		||||
public:
 | 
			
		||||
  DefaultPeerStorage(BtContextHandle btContext, const Option* option);
 | 
			
		||||
  virtual ~DefaultPeerStorage();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -60,6 +60,7 @@ PeerAbstractCommand::~PeerAbstractCommand() {
 | 
			
		|||
 | 
			
		||||
bool PeerAbstractCommand::execute() {
 | 
			
		||||
  if(btRuntime->isHalt()) {
 | 
			
		||||
    peer->resetStatus();
 | 
			
		||||
    return true;
 | 
			
		||||
  }
 | 
			
		||||
  try {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue