mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-21 23:54:14 +00:00
Cleanup and final comments
This commit is contained in:
parent
9415a49fbd
commit
849ab03e1c
12
Reseed.cpp
12
Reseed.cpp
@ -1,6 +1,5 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
#include "Reseed.h"
|
||||
#include "Log.h"
|
||||
@ -11,7 +10,8 @@ namespace i2p
|
||||
{
|
||||
namespace data
|
||||
{
|
||||
|
||||
//TODO: Implement v2 reseeding. Lightweight zip library is needed.
|
||||
//TODO: Implement SU3, utils.
|
||||
Reseeder::Reseeder()
|
||||
{
|
||||
}
|
||||
@ -32,10 +32,11 @@ namespace data
|
||||
LogPrint("Reseed failed");
|
||||
return false;
|
||||
}
|
||||
boost::regex e("<\\s*A\\s+[^>]*href\\s*=\\s*\"([^\"]*)\"",
|
||||
boost::regex::normal | boost::regbase::icase);
|
||||
boost::regex e("<\\s*A\\s+[^>]*href\\s*=\\s*\"([^\"]*)\"", boost::regex::normal | boost::regbase::icase);
|
||||
boost::sregex_token_iterator i(content.begin(), content.end(), e, 1);
|
||||
boost::sregex_token_iterator j;
|
||||
//TODO: Ugly code, try to clean up.
|
||||
//TODO: Try to reduce N number of variables
|
||||
std::string name;
|
||||
std::string routerInfo;
|
||||
std::string tmpUrl;
|
||||
@ -43,7 +44,6 @@ namespace data
|
||||
std::string ignoreFileSuffix = ".zip";
|
||||
while (i != j)
|
||||
{
|
||||
//TODO: Ugly code, try to clean up.
|
||||
name = *i++;
|
||||
if (name.find(ignoreFileSuffix)!=std::string::npos)
|
||||
continue;
|
||||
@ -52,7 +52,7 @@ namespace data
|
||||
tmpUrl.append(name);
|
||||
routerInfo = i2p::util::http::httpRequest(tmpUrl);
|
||||
filename = "netDb/r";
|
||||
filename += name.at(11);
|
||||
filename += name.at(11); // first char in id
|
||||
filename.append("/");
|
||||
filename.append(name.c_str());
|
||||
std::ofstream outfile (filename, std::ios::binary);
|
||||
|
3
util.cpp
3
util.cpp
@ -49,8 +49,6 @@ const char* GetCharArg(const std::string& strArg, const std::string& nDefault)
|
||||
|
||||
namespace http
|
||||
{
|
||||
//TODO: Implement v2 reseeding. Lightweight zip library is needed.
|
||||
//TODO: Implement SU3, utils.
|
||||
std::string httpRequest(const std::string& address)
|
||||
{
|
||||
try
|
||||
@ -61,7 +59,6 @@ namespace http
|
||||
site.connect(u.host_, "http");
|
||||
if (site)
|
||||
{
|
||||
//site.expires_from_now (boost::posix_time::seconds (10)); // wait for 10 seconds
|
||||
// User-Agent is needed to get the server list routerInfo files.
|
||||
site << "GET " << u.path_ << " HTTP/1.0\r\nHost: " << u.host_
|
||||
<< "\r\nAccept: */*\r\n" << "User-Agent: Wget/1.11.4\r\n" << "Connection: close\r\n\r\n";
|
||||
|
Loading…
x
Reference in New Issue
Block a user