Initial support for fetch newcoin.txt via https.

This commit is contained in:
Arthur Britto
2012-03-29 21:14:57 -07:00
parent c70bf8465f
commit 98d6065460
7 changed files with 513 additions and 18 deletions

View File

@@ -3,22 +3,48 @@
#include "../json/value.h"
#include "uint256.h"
#include "NewcoinAddress.h"
#include "HttpsClient.h"
#include <boost/thread/mutex.hpp>
#include <boost/container/deque.hpp>
// Guarantees minimum thoughput of 1 node per second.
#define NODE_FETCH_JOBS 10
#define NODE_FETCH_SECONDS 10
#define NODE_FILE_BYTES_MAX (50<<10) // 50k
#define NODE_FILE_NAME "newcoin.txt"
#define NODE_FILE_PATH "/" NODE_FILE_NAME
class UniqueNodeList
{
private:
void fetchResponse(const boost::system::error_code& err, std::string strResponse);
// hanko to public key
//std::map<uint160, uint256> mUNL;
boost::mutex mFetchLock;
int mFetchActive; // count of active fetches
boost::container::deque<std::string> mFetchPending;
void fetchNext();
void fetchProcess(std::string strDomain);
public:
void addNode(NewcoinAddress nodePublic, std::string strComment);
void removeNode(NewcoinAddress hanko);
UniqueNodeList();
void addNode(NewcoinAddress naNodePublic, std::string strComment);
void fetchNode(std::string strDomain);
void removeNode(NewcoinAddress naHanko);
void reset();
// 0- we don't care, 1- we care and is valid, 2-invalid signature
// 2- we don't care, 1- we care and is valid, 2-invalid signature
// int checkValid(newcoin::Validation& valid);
Json::Value getUnlJson();
};
#endif
// vim:ts=4