mirror of https://github.com/aria2/aria2
2007-06-04 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Accept incoming connections if download rate is low. * src/PeerListenCommand.h, src/PeerListenCommand.cc: (_lowestSpeedLimit): New variable. (setLowestSpeedLimit): New function. (execute): Accept incoming connections if download rate is low. MAX_PEERS is ignored in this case.pull/1/head
parent
453e2f10dd
commit
47ce21a469
|
@ -1,3 +1,12 @@
|
||||||
|
2007-06-04 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||||
|
|
||||||
|
Accept incoming connections if download rate is low.
|
||||||
|
* src/PeerListenCommand.h, src/PeerListenCommand.cc:
|
||||||
|
(_lowestSpeedLimit): New variable.
|
||||||
|
(setLowestSpeedLimit): New function.
|
||||||
|
(execute): Accept incoming connections if download rate is low.
|
||||||
|
MAX_PEERS is ignored in this case.
|
||||||
|
|
||||||
2007-06-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
2007-06-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||||
|
|
||||||
RequestGroup::getNextCommand() was renamed to createNextCommand().
|
RequestGroup::getNextCommand() was renamed to createNextCommand().
|
||||||
|
|
1
TODO
1
TODO
|
@ -34,3 +34,4 @@
|
||||||
* Do not use ufilename in multi-simultaneous download mode.
|
* Do not use ufilename in multi-simultaneous download mode.
|
||||||
* Create download command directly when 1connection download.
|
* Create download command directly when 1connection download.
|
||||||
Consider timeout when file allocation/check integrity is enabled.
|
Consider timeout when file allocation/check integrity is enabled.
|
||||||
|
* Accept incoming connections if download rate is low.
|
||||||
|
|
|
@ -41,7 +41,8 @@ PeerListenCommand::PeerListenCommand(int cuid,
|
||||||
TorrentDownloadEngine* e,
|
TorrentDownloadEngine* e,
|
||||||
const BtContextHandle& btContext)
|
const BtContextHandle& btContext)
|
||||||
:BtContextAwareCommand(cuid, btContext),
|
:BtContextAwareCommand(cuid, btContext),
|
||||||
e(e) {}
|
e(e),
|
||||||
|
_lowestSpeedLimit(20*1024) {}
|
||||||
|
|
||||||
PeerListenCommand::~PeerListenCommand() {}
|
PeerListenCommand::~PeerListenCommand() {}
|
||||||
|
|
||||||
|
@ -77,8 +78,11 @@ bool PeerListenCommand::execute() {
|
||||||
peerSocket->getPeerInfo(peerInfo);
|
peerSocket->getPeerInfo(peerInfo);
|
||||||
pair<string, int> localInfo;
|
pair<string, int> localInfo;
|
||||||
peerSocket->getAddrInfo(localInfo);
|
peerSocket->getAddrInfo(localInfo);
|
||||||
|
|
||||||
|
TransferStat tstat = peerStorage->calculateStat();
|
||||||
if(peerInfo.first != localInfo.first &&
|
if(peerInfo.first != localInfo.first &&
|
||||||
btRuntime->getConnections() < MAX_PEERS) {
|
(!pieceStorage->downloadFinished() && tstat.getDownloadSpeed() < _lowestSpeedLimit ||
|
||||||
|
btRuntime->getConnections() < MAX_PEERS)) {
|
||||||
PeerHandle peer = PeerHandle(new Peer(peerInfo.first, peerInfo.second,
|
PeerHandle peer = PeerHandle(new Peer(peerInfo.first, peerInfo.second,
|
||||||
btContext->getPieceLength(),
|
btContext->getPieceLength(),
|
||||||
btContext->getTotalLength()));
|
btContext->getTotalLength()));
|
||||||
|
|
|
@ -42,6 +42,7 @@ class PeerListenCommand : public BtContextAwareCommand {
|
||||||
private:
|
private:
|
||||||
TorrentDownloadEngine* e;
|
TorrentDownloadEngine* e;
|
||||||
SocketHandle socket;
|
SocketHandle socket;
|
||||||
|
int32_t _lowestSpeedLimit;
|
||||||
public:
|
public:
|
||||||
PeerListenCommand(int cuid,
|
PeerListenCommand(int cuid,
|
||||||
TorrentDownloadEngine* e,
|
TorrentDownloadEngine* e,
|
||||||
|
@ -52,6 +53,11 @@ public:
|
||||||
bool execute();
|
bool execute();
|
||||||
|
|
||||||
int bindPort(int portRangeStart, int portRangeEnd);
|
int bindPort(int portRangeStart, int portRangeEnd);
|
||||||
|
|
||||||
|
void setLowestSpeedLimit(int32_t speed)
|
||||||
|
{
|
||||||
|
_lowestSpeedLimit = speed;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _D_PEER_LISTEN_COMMAND_H_
|
#endif // _D_PEER_LISTEN_COMMAND_H_
|
||||||
|
|
Loading…
Reference in New Issue