Logger changes
This commit is contained in:
parent
db74edbb51
commit
f7297aa4be
|
@ -22,8 +22,6 @@
|
||||||
namespace UDPT {
|
namespace UDPT {
|
||||||
Logger::Logger(Settings *s, ostream &os) : logfile (os)
|
Logger::Logger(Settings *s, ostream &os) : logfile (os)
|
||||||
{
|
{
|
||||||
this->max_time = 120;
|
|
||||||
this->queue_limit = 50;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logger::log(enum LogLevel lvl, string msg)
|
void Logger::log(enum LogLevel lvl, string msg)
|
||||||
|
|
|
@ -43,8 +43,6 @@ namespace UDPT {
|
||||||
void log (enum LogLevel, string msg);
|
void log (enum LogLevel, string msg);
|
||||||
private:
|
private:
|
||||||
ostream &logfile;
|
ostream &logfile;
|
||||||
unsigned int queue_limit;
|
|
||||||
int max_time;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,9 @@ namespace UDPT
|
||||||
pthread_detach (this->threads[i]);
|
pthread_detach (this->threads[i]);
|
||||||
pthread_cancel (this->threads[i]);
|
pthread_cancel (this->threads[i]);
|
||||||
#endif
|
#endif
|
||||||
cout << "Thread (" << ( i + 1) << "/" << ((int)this->thread_count) << ") terminated." << endl;
|
stringstream str;
|
||||||
|
str << "Thread (" << (i + 1) << "/" << ((int)this->thread_count) << ") terminated.";
|
||||||
|
logger->log(Logger::LL_INFO, str.str());
|
||||||
}
|
}
|
||||||
if (this->conn != NULL)
|
if (this->conn != NULL)
|
||||||
delete this->conn;
|
delete this->conn;
|
||||||
|
@ -334,7 +336,6 @@ namespace UDPT
|
||||||
i, // loop counter
|
i, // loop counter
|
||||||
j; // loop counter
|
j; // loop counter
|
||||||
uint8_t hash [20];
|
uint8_t hash [20];
|
||||||
char xHash [50];
|
|
||||||
ScrapeResponse *resp;
|
ScrapeResponse *resp;
|
||||||
uint8_t buffer [1024]; // up to 74 torrents can be scraped at once (17*74+8) < 1024
|
uint8_t buffer [1024]; // up to 74 torrents can be scraped at once (17*74+8) < 1024
|
||||||
|
|
||||||
|
@ -372,10 +373,6 @@ namespace UDPT
|
||||||
for (j = 0; j < 20;j++)
|
for (j = 0; j < 20;j++)
|
||||||
hash[j] = data[j + (i*20)+16];
|
hash[j] = data[j + (i*20)+16];
|
||||||
|
|
||||||
to_hex_str (hash, xHash);
|
|
||||||
|
|
||||||
cout << "\t" << xHash << endl;
|
|
||||||
|
|
||||||
seeders = (int32_t*)&buffer[i*12+8];
|
seeders = (int32_t*)&buffer[i*12+8];
|
||||||
completed = (int32_t*)&buffer[i*12+12];
|
completed = (int32_t*)&buffer[i*12+12];
|
||||||
leechers = (int32_t*)&buffer[i*12+16];
|
leechers = (int32_t*)&buffer[i*12+16];
|
||||||
|
@ -392,7 +389,6 @@ namespace UDPT
|
||||||
*completed = m_hton32 (tE.completed);
|
*completed = m_hton32 (tE.completed);
|
||||||
*leechers = m_hton32 (tE.leechers);
|
*leechers = m_hton32 (tE.leechers);
|
||||||
}
|
}
|
||||||
cout.flush();
|
|
||||||
|
|
||||||
sendto (usi->sock, (const char*)buffer, sizeof(buffer), 0, (SOCKADDR*)remote, sizeof(SOCKADDR_IN));
|
sendto (usi->sock, (const char*)buffer, sizeof(buffer), 0, (SOCKADDR*)remote, sizeof(SOCKADDR_IN));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue