mirror of
https://github.com/aria2/aria2.git
synced 2024-12-14 09:28:55 +00:00
574ca31e38
Contact tracker frequently when the number of connections are 0 and download is not finished yet. * src/ActivePeerConnectionCommand.cc * src/BtAnnounce.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * test/MockBtAnnounce.h
69 lines
1.2 KiB
C++
69 lines
1.2 KiB
C++
#ifndef _D_MOCK_BT_ANNOUNCE_H_
|
|
#define _D_MOCK_BT_ANNOUNCE_H_
|
|
|
|
#include "BtAnnounce.h"
|
|
|
|
namespace aria2 {
|
|
|
|
class MockBtAnnounce : public BtAnnounce {
|
|
private:
|
|
bool announceReady;
|
|
std::string announceUrl;
|
|
std::string peerId;
|
|
public:
|
|
MockBtAnnounce() {}
|
|
virtual ~MockBtAnnounce() {}
|
|
|
|
virtual bool isAnnounceReady() {
|
|
return announceReady;
|
|
}
|
|
|
|
void setAnnounceReady(bool flag) {
|
|
this->announceReady = flag;
|
|
}
|
|
|
|
virtual std::string getAnnounceUrl() {
|
|
return announceUrl;
|
|
}
|
|
|
|
void setAnnounceUrl(const std::string& url) {
|
|
this->announceUrl = url;
|
|
}
|
|
|
|
virtual void announceStart() {}
|
|
|
|
virtual void announceSuccess() {}
|
|
|
|
virtual void announceFailure() {}
|
|
|
|
virtual bool isAllAnnounceFailed() {
|
|
return false;
|
|
}
|
|
|
|
virtual void resetAnnounce() {}
|
|
|
|
virtual void processAnnounceResponse(const unsigned char* trackerResponse,
|
|
size_t trackerResponseLength) {}
|
|
|
|
virtual bool noMoreAnnounce() {
|
|
return false;
|
|
}
|
|
|
|
virtual void shuffleAnnounce() {
|
|
}
|
|
|
|
virtual std::string getPeerId() {
|
|
return peerId;
|
|
}
|
|
|
|
virtual void overrideMinInterval(time_t interval) {}
|
|
|
|
void setPeerId(const std::string& peerId) {
|
|
this->peerId = peerId;
|
|
}
|
|
};
|
|
|
|
} // namespace aria2
|
|
|
|
#endif // _D_MOCK_BT_ANNOUNCE_H_
|