mirror of
https://github.com/aria2/aria2.git
synced 2025-01-24 02:31:29 +00:00
584af68e19
Execute 5 DHT tasks concurrently in each task queue. * src/DHTTaskExecutor.cc * src/DHTTaskExecutor.h * src/DHTTaskQueueImpl.cc * src/DHTTaskQueueImpl.h * src/Makefile.am * test/DHTTaskExecutorTest.cc * test/Makefile.am * test/MockDHTTask.h
43 lines
696 B
C++
43 lines
696 B
C++
#ifndef _D_MOCK_DHT_TASK_H_
|
|
#define _D_MOCK_DHT_TASK_H_
|
|
|
|
#include "DHTTask.h"
|
|
|
|
#include <cstring>
|
|
|
|
#include "DHTNode.h"
|
|
#include "DHTConstants.h"
|
|
|
|
namespace aria2 {
|
|
|
|
class MockDHTTask:public DHTTask {
|
|
public:
|
|
SharedHandle<DHTNode> remoteNode_;
|
|
|
|
unsigned char targetID_[DHT_ID_LENGTH];
|
|
|
|
bool finished_;
|
|
|
|
MockDHTTask(const SharedHandle<DHTNode>& remoteNode):
|
|
remoteNode_(remoteNode),
|
|
finished_(false) {}
|
|
|
|
virtual ~MockDHTTask() {}
|
|
|
|
virtual void startup() {}
|
|
|
|
virtual bool finished()
|
|
{
|
|
return finished_;
|
|
}
|
|
|
|
void setTargetID(const unsigned char* targetID)
|
|
{
|
|
memcpy(targetID_, targetID, DHT_ID_LENGTH);
|
|
}
|
|
};
|
|
|
|
} // namespace aria2
|
|
|
|
#endif // _D_MOCK_DHT_TASK_H_
|