mirror of https://github.com/aria2/aria2
Attempt to add the ability to listing file entries in a .torrent
file. This feature is not yet complete. * src/prefs.h (PREF_TORRENT_SHOW_FILES): New definition * src/TorrentMan.cc (getMultiFileEntries): New function. (getName): New function. * src/TorrentMan.h (getMultiFileEntries): New function. (getName): New function. * src/main.cc (main): Use above 2 funtion.pull/1/head
parent
9c67466cde
commit
1013d207f3
20
ChangeLog
20
ChangeLog
|
@ -1,10 +1,24 @@
|
|||
2006-04-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Attempt to add the ability to listing file entries in a .torrent file.
|
||||
This feature is not yet complete.
|
||||
|
||||
* src/prefs.h (PREF_TORRENT_SHOW_FILES): New definition
|
||||
* src/TorrentMan.cc (getMultiFileEntries): New function.
|
||||
(getName): New function.
|
||||
* src/TorrentMan.h (getMultiFileEntries): New function.
|
||||
(getName): New function.
|
||||
* src/main.cc (main): Use above 2 funtion.
|
||||
|
||||
* Release 0.3.2
|
||||
|
||||
2006-03-31 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
* src/PeerInteractionCommand.cc (checkInactiveConnection): New function
|
||||
(detectMessageFlooding): Updated.
|
||||
(checkLongTimePeerChoking): Updated.
|
||||
(detectMessageFlooding): Updated threshold value.
|
||||
(checkLongTimePeerChoking): Updated timeout value.
|
||||
(getNewPieceAndSendInterest): Added debug log.
|
||||
* src/PeerInteractionCommand.h: New function checkInactiveConnection()
|
||||
* src/PeerInteractionCommand.h (checkInactiveConnection): New function
|
||||
|
||||
* src/TorrentMan.cc (deleteOldErrorPeers): Updated.
|
||||
(getPeer): Updated.
|
||||
|
|
|
@ -336,7 +336,7 @@ Piece PeerInteractionCommand::getNewPieceAndSendInterest() {
|
|||
PendingMessage pendingMessage(PeerMessage::NOT_INTERESTED, peerConnection);
|
||||
sendMessageQueue->addPendingMessage(pendingMessage);
|
||||
} else {
|
||||
e->logger->debug("CUID#%d - starting download for piece #%d", cuid, piece.getIndex());
|
||||
e->logger->debug("CUID#%d - starting download for piece index=%d", cuid, piece.getIndex());
|
||||
e->logger->debug("CUID#%d - try to send interested", cuid);
|
||||
PendingMessage pendingMessage(PeerMessage::INTERESTED, peerConnection);
|
||||
sendMessageQueue->addPendingMessage(pendingMessage);
|
||||
|
|
|
@ -381,6 +381,14 @@ void TorrentMan::setup(string metaInfoFile) {
|
|||
setupComplete = true;
|
||||
}
|
||||
|
||||
const MultiFileEntries& TorrentMan::getMultiFileEntries() const {
|
||||
return multiFileEntries;
|
||||
}
|
||||
|
||||
string TorrentMan::getName() const {
|
||||
return name;
|
||||
}
|
||||
|
||||
bool TorrentMan::hasPiece(int index) const {
|
||||
return bitfield->isBitSet(index);
|
||||
}
|
||||
|
|
|
@ -223,6 +223,9 @@ public:
|
|||
int countUsedPiece() const { return usedPieces.size(); }
|
||||
int countAdvertisedPiece() const { return haves.size(); }
|
||||
|
||||
const MultiFileEntries& getMultiFileEntries() const;
|
||||
string getName() const;
|
||||
|
||||
enum FILE_MODE {
|
||||
SINGLE,
|
||||
MULTI
|
||||
|
|
20
src/main.cc
20
src/main.cc
|
@ -577,7 +577,25 @@ int main(int argc, char* argv[]) {
|
|||
te->torrentMan->logger = logger;
|
||||
te->torrentMan->setup(torrentFile.empty() ?
|
||||
downloadedTorrentFile : torrentFile);
|
||||
|
||||
if(op->get(PREF_TORRENT_SHOW_FILES) == V_TRUE) {
|
||||
cout << "File listing:" << endl;
|
||||
switch(te->torrentMan->getFileMode()) {
|
||||
case TorrentMan::SINGLE:
|
||||
printf("%s %s\nBytes", te->torrentMan->getName().c_str(),
|
||||
Util::llitos(te->torrentMan->getTotalLength(), true).c_str());
|
||||
break;
|
||||
case TorrentMan::MULTI: {
|
||||
const MultiFileEntries& entries = te->torrentMan->getMultiFileEntries();
|
||||
for(MultiFileEntries::const_iterator itr = entries.begin();
|
||||
itr != entries.end(); itr++) {
|
||||
printf("%s %s\nBytes", itr->path.c_str(),
|
||||
Util::llitos(itr->length, true).c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
PeerListenCommand* listenCommand =
|
||||
new PeerListenCommand(te->torrentMan->getNewCuid(), te);
|
||||
int port = listenCommand->bindPort(6881, 6999);
|
||||
|
|
|
@ -88,5 +88,7 @@
|
|||
*/
|
||||
// values: 1*digit
|
||||
#define PREF_PEER_CONNECTION_TIMEOUT "peer_connection_timeout"
|
||||
// values: true | false
|
||||
#define PREF_TORRENT_SHOW_FILES "torrent_show_files"
|
||||
|
||||
#endif // _D_PREFS_H_
|
||||
|
|
Loading…
Reference in New Issue