mirror of https://github.com/aria2/aria2
				
				
				
			rename TorrentMan::downloadedSize to TorrentMan::downloadLength
							parent
							
								
									133f759a0d
								
							
						
					
					
						commit
						8b94be7475
					
				| 
						 | 
					@ -81,7 +81,7 @@ bool PeerInteractionCommand::executeInternal() {
 | 
				
			||||||
		    peer->ipaddr.c_str(), peer->port,
 | 
							    peer->ipaddr.c_str(), peer->port,
 | 
				
			||||||
		    handshakeMessage->toString().c_str());
 | 
							    handshakeMessage->toString().c_str());
 | 
				
			||||||
    delete handshakeMessage;
 | 
					    delete handshakeMessage;
 | 
				
			||||||
    if(e->torrentMan->getDownloadedSize() > 0) {
 | 
					    if(e->torrentMan->getDownloadLength() > 0) {
 | 
				
			||||||
      peerConnection->sendBitfield();
 | 
					      peerConnection->sendBitfield();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    sequence = WIRED;
 | 
					    sequence = WIRED;
 | 
				
			||||||
| 
						 | 
					@ -98,7 +98,7 @@ bool PeerInteractionCommand::executeInternal() {
 | 
				
			||||||
		    handshakeMessage->toString().c_str());
 | 
							    handshakeMessage->toString().c_str());
 | 
				
			||||||
    delete handshakeMessage;
 | 
					    delete handshakeMessage;
 | 
				
			||||||
    peerConnection->sendHandshake();
 | 
					    peerConnection->sendHandshake();
 | 
				
			||||||
    if(e->torrentMan->getDownloadedSize() > 0) {
 | 
					    if(e->torrentMan->getDownloadLength() > 0) {
 | 
				
			||||||
      peerConnection->sendBitfield();
 | 
					      peerConnection->sendBitfield();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    sequence = WIRED;    
 | 
					    sequence = WIRED;    
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -33,10 +33,10 @@ void TorrentConsoleDownloadEngine::printStatistics() {
 | 
				
			||||||
    printf("Download Completed ");
 | 
					    printf("Download Completed ");
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    printf("%s/%sB %d%% DW:%.2f",
 | 
					    printf("%s/%sB %d%% DW:%.2f",
 | 
				
			||||||
	   Util::llitos(torrentMan->getDownloadedSize(), true).c_str(),
 | 
						   Util::llitos(torrentMan->getDownloadLength(), true).c_str(),
 | 
				
			||||||
	   Util::llitos(torrentMan->totalSize, true).c_str(),
 | 
						   Util::llitos(torrentMan->totalSize, true).c_str(),
 | 
				
			||||||
	   (torrentMan->totalSize == 0 ?
 | 
						   (torrentMan->totalSize == 0 ?
 | 
				
			||||||
	    0 : (int)((torrentMan->getDownloadedSize()*100)/torrentMan->totalSize)),
 | 
						    0 : (int)((torrentMan->getDownloadLength()*100)/torrentMan->totalSize)),
 | 
				
			||||||
	   downloadSpeed/1000.0);
 | 
						   downloadSpeed/1000.0);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  printf(" UP:%.2f(%s) %dpeers",
 | 
					  printf(" UP:%.2f(%s) %dpeers",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -35,7 +35,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TorrentMan::TorrentMan():bitfield(NULL),
 | 
					TorrentMan::TorrentMan():bitfield(NULL),
 | 
				
			||||||
			 peerEntryIdCounter(0), cuidCounter(0),
 | 
								 peerEntryIdCounter(0), cuidCounter(0),
 | 
				
			||||||
			 downloadedSize(0), uploadedSize(0),
 | 
								 downloadLength(0), uploadedSize(0),
 | 
				
			||||||
			 preDownloadedSize(0), preUploadedSize(0),
 | 
								 preDownloadedSize(0), preUploadedSize(0),
 | 
				
			||||||
			 deltaDownload(0), deltaUpload(0),
 | 
								 deltaDownload(0), deltaUpload(0),
 | 
				
			||||||
			 storeDir("."),
 | 
								 storeDir("."),
 | 
				
			||||||
| 
						 | 
					@ -226,7 +226,7 @@ void TorrentMan::completePiece(const Piece& piece) {
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if(!hasPiece(piece.getIndex())) {
 | 
					  if(!hasPiece(piece.getIndex())) {
 | 
				
			||||||
    addDownloadedSize(piece.getLength());
 | 
					    addDownloadLength(piece.getLength());
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  bitfield->setBit(piece.getIndex());
 | 
					  bitfield->setBit(piece.getIndex());
 | 
				
			||||||
  bitfield->unsetUseBit(piece.getIndex());
 | 
					  bitfield->unsetUseBit(piece.getIndex());
 | 
				
			||||||
| 
						 | 
					@ -302,7 +302,7 @@ void TorrentMan::setup(string metaInfoFile) {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uploadedSize = 0;
 | 
					  uploadedSize = 0;
 | 
				
			||||||
  downloadedSize = 0;
 | 
					  downloadLength = 0;
 | 
				
			||||||
  Dictionary* topDic = (Dictionary*)MetaFileUtil::parseMetaFile(metaInfoFile);
 | 
					  Dictionary* topDic = (Dictionary*)MetaFileUtil::parseMetaFile(metaInfoFile);
 | 
				
			||||||
  const Dictionary* infoDic = (const Dictionary*)topDic->get("info");
 | 
					  const Dictionary* infoDic = (const Dictionary*)topDic->get("info");
 | 
				
			||||||
  ShaVisitor v;
 | 
					  ShaVisitor v;
 | 
				
			||||||
| 
						 | 
					@ -445,13 +445,13 @@ void TorrentMan::read(FILE* file) {
 | 
				
			||||||
      throw new DlAbortEx(strerror(errno));
 | 
					      throw new DlAbortEx(strerror(errno));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    setBitfield(savedBitfield, bitfield->getBitfieldLength());
 | 
					    setBitfield(savedBitfield, bitfield->getBitfieldLength());
 | 
				
			||||||
    if(fread(&downloadedSize, sizeof(downloadedSize), 1, file) < 1) {
 | 
					    if(fread(&downloadLength, sizeof(downloadLength), 1, file) < 1) {
 | 
				
			||||||
      throw new DlAbortEx(strerror(errno));
 | 
					      throw new DlAbortEx(strerror(errno));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if(fread(&uploadedSize, sizeof(uploadedSize), 1, file) < 1) {
 | 
					    if(fread(&uploadedSize, sizeof(uploadedSize), 1, file) < 1) {
 | 
				
			||||||
      throw new DlAbortEx(strerror(errno));
 | 
					      throw new DlAbortEx(strerror(errno));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    preDownloadedSize = downloadedSize;
 | 
					    preDownloadedSize = downloadLength;
 | 
				
			||||||
    preUploadedSize = uploadedSize;
 | 
					    preUploadedSize = uploadedSize;
 | 
				
			||||||
    delete [] savedBitfield;
 | 
					    delete [] savedBitfield;
 | 
				
			||||||
  } catch(Exception* ex) {
 | 
					  } catch(Exception* ex) {
 | 
				
			||||||
| 
						 | 
					@ -473,7 +473,7 @@ void TorrentMan::save() const {
 | 
				
			||||||
  if(fwrite(bitfield->getBitfield(), bitfield->getBitfieldLength(), 1, file) < 1) {
 | 
					  if(fwrite(bitfield->getBitfield(), bitfield->getBitfieldLength(), 1, file) < 1) {
 | 
				
			||||||
    throw new DlAbortEx(strerror(errno));
 | 
					    throw new DlAbortEx(strerror(errno));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if(fwrite(&downloadedSize, sizeof(downloadedSize), 1, file) < 1) {
 | 
					  if(fwrite(&downloadLength, sizeof(downloadLength), 1, file) < 1) {
 | 
				
			||||||
    throw new DlAbortEx(strerror(errno));
 | 
					    throw new DlAbortEx(strerror(errno));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if(fwrite(&uploadedSize, sizeof(uploadedSize), 1, file) < 1) {
 | 
					  if(fwrite(&uploadedSize, sizeof(uploadedSize), 1, file) < 1) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -73,7 +73,7 @@ private:
 | 
				
			||||||
  deque<string> pieceHashes;
 | 
					  deque<string> pieceHashes;
 | 
				
			||||||
  int peerEntryIdCounter;
 | 
					  int peerEntryIdCounter;
 | 
				
			||||||
  int cuidCounter;
 | 
					  int cuidCounter;
 | 
				
			||||||
  long long int downloadedSize;
 | 
					  long long int downloadLength;
 | 
				
			||||||
  long long int uploadedSize;
 | 
					  long long int uploadedSize;
 | 
				
			||||||
  long long int preDownloadedSize;
 | 
					  long long int preDownloadedSize;
 | 
				
			||||||
  long long int preUploadedSize;
 | 
					  long long int preUploadedSize;
 | 
				
			||||||
| 
						 | 
					@ -181,16 +181,16 @@ public:
 | 
				
			||||||
  int getDeltaUpload() const { return deltaUpload; }
 | 
					  int getDeltaUpload() const { return deltaUpload; }
 | 
				
			||||||
  void resetDeltaUpload() { deltaUpload = 0; }
 | 
					  void resetDeltaUpload() { deltaUpload = 0; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void addDownloadedSize(int size) { downloadedSize += size; }
 | 
					  void addDownloadLength(int deltaLength) { downloadLength += deltaLength; }
 | 
				
			||||||
  long long int getDownloadedSize() const { return downloadedSize; }
 | 
					  long long int getDownloadLength() const { return downloadLength; }
 | 
				
			||||||
  void setDownloadedSize(long long int size) { downloadedSize = size; }
 | 
					  void setDownloadLength(long long int length) { downloadLength = length; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void addUploadedSize(int size) { uploadedSize += size; }
 | 
					  void addUploadedSize(int size) { uploadedSize += size; }
 | 
				
			||||||
  long long int getUploadedSize() const { return uploadedSize; }
 | 
					  long long int getUploadedSize() const { return uploadedSize; }
 | 
				
			||||||
  void setUploadedSize(long long int size) { uploadedSize = size; }
 | 
					  void setUploadedSize(long long int size) { uploadedSize = size; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  long long int getSessionDownloadedSize() const {
 | 
					  long long int getSessionDownloadedSize() const {
 | 
				
			||||||
    return downloadedSize-preDownloadedSize;
 | 
					    return downloadLength-preDownloadedSize;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  long long int getSessionUploadedSize() const {
 | 
					  long long int getSessionUploadedSize() const {
 | 
				
			||||||
    return uploadedSize-preUploadedSize;
 | 
					    return uploadedSize-preUploadedSize;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -59,8 +59,8 @@ bool TrackerInitCommand::execute() {
 | 
				
			||||||
    "port="+Util::itos(e->torrentMan->getPort())+"&"+
 | 
					    "port="+Util::itos(e->torrentMan->getPort())+"&"+
 | 
				
			||||||
    "uploaded="+Util::llitos(e->torrentMan->getSessionUploadedSize())+"&"+
 | 
					    "uploaded="+Util::llitos(e->torrentMan->getSessionUploadedSize())+"&"+
 | 
				
			||||||
    "downloaded="+Util::llitos(e->torrentMan->getSessionDownloadedSize())+"&"+
 | 
					    "downloaded="+Util::llitos(e->torrentMan->getSessionDownloadedSize())+"&"+
 | 
				
			||||||
    "left="+(e->torrentMan->totalSize-e->torrentMan->getDownloadedSize() <= 0
 | 
					    "left="+(e->torrentMan->totalSize-e->torrentMan->getDownloadLength() <= 0
 | 
				
			||||||
	     ? "0" : Util::llitos(e->torrentMan->totalSize-e->torrentMan->getDownloadedSize()))+"&"+
 | 
						     ? "0" : Util::llitos(e->torrentMan->totalSize-e->torrentMan->getDownloadLength()))+"&"+
 | 
				
			||||||
    "compact=1";
 | 
					    "compact=1";
 | 
				
			||||||
  if(!event.empty()) {
 | 
					  if(!event.empty()) {
 | 
				
			||||||
    url += string("&")+"event="+event;
 | 
					    url += string("&")+"event="+event;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue