added sleep between modinfo downloading, slowed down a bit but not DoS-ing rubenwardy' s hosting now

master
Phitherek 2013-04-08 16:02:00 +02:00
parent a312f72eab
commit 930c0bca21
4 changed files with 58 additions and 1 deletions

View File

@ -135,6 +135,7 @@ for(unsigned int i = 0; i < _modinfos.size(); i++) {
ModInfo mi(_modinfos[i].getModInfoDescription());
std::cout << "Successfully downloaded and parsed: " << mi.getName() << std::endl;
_modinfos[i] = mi;
sleep(2); // This is to prevent DoS-ing rubenwardy' s hosting...
} catch(NetSocketPP::NetworkException &exc) {
std::cerr << "NetworkException occured in NetSocket++: " << exc.what() << std::endl;
} catch(NetSocketPP::SocketException &exc) {

View File

@ -10,7 +10,8 @@ ModInfoDescription: name, server, modinfoPath x
ModInfo: ModInfoDescription, vector<ModDescription> x
ParameterParser: actionList, argc, argv
Action: x
SyncAction
SyncAction x
QueryAction
InstallAction
UpdateAction
RemoveAction

23
QueryAction.cpp Normal file
View File

@ -0,0 +1,23 @@
#include "QueryAction.h"
#include <iostream>
#include <cstdlib>
using namespace mmm;
QueryAction::QueryAction(): Action() {
_local = false;
}
QueryAction::QueryAction(bool local): Action() {
_local = local;
}
QueryAction::~QueryAction() {}
void QueryAction::run() {
std::cout << "Starting Query" << std::endl;
if(_local) {
} else {
}
}

32
QueryAction.h Normal file
View File

@ -0,0 +1,32 @@
#ifndef _QUERYACTION_H
#define _QUERYACTION_H
#include "ConfigFile.h"
#include "3mExceptions.h"
#include "ModDescription.h"
#include "LocalModDescription.h"
#include "LocalModList.h"
#include "Action.h"
#include <string>
/// \file QueryAction.h
/// \brief A Query 3m action class.
/// \author Phitherek_
/// \date 2013
/// \version 0.1-pre
/// \namespace mmm
/// \brief A global namespace for 3m.
namespace mmm {
/// \class QueryAction
/// \brief A Query 3m action class.
class QueryAction: public Action {
private:
bool _local;
public:
QueryAction(); ///< A constructor.
QueryAction(bool local); ///< \brief A constructor with parameter.
///< \param local Indicated if to search in local repository or remote repositories.
~QueryAction(); ///< A destructor.
void run(); ///< A virtual function that executes the action.
};
}
#endif