Browse Source

add naming to threads

Signed-off-by: R4SAS <r4sas@i2pmail.org>
pull/1595/head
R4SAS 4 years ago
parent
commit
36473e3889
  1. 2
      daemon/HTTPServer.cpp
  2. 2
      daemon/I2PControl.cpp
  3. 2
      daemon/UPnP.cpp
  4. 2
      libi2pd/Log.cpp
  5. 1
      libi2pd/NTCP2.h
  6. 3
      libi2pd/NetDb.cpp
  7. 7
      libi2pd/SSU.cpp
  8. 2
      libi2pd/Timestamp.cpp
  9. 5
      libi2pd/Transports.cpp
  10. 2
      libi2pd/Tunnel.cpp
  11. 1
      libi2pd/util.cpp
  12. 1
      libi2pd_client/AddressBook.cpp
  13. 2
      libi2pd_client/I2PTunnel.cpp

2
daemon/HTTPServer.cpp

@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
#include <iomanip>
#include <sstream>
#include <thread>
#include <pthread.h>
#include <memory>
#include <boost/asio.hpp>
@ -1312,6 +1313,7 @@ namespace http { @@ -1312,6 +1313,7 @@ namespace http {
void HTTPServer::Run ()
{
pthread_setname_np(pthread_self(), "Webconsole");
while (m_IsRunning)
{
try

2
daemon/I2PControl.cpp

@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/property_tree/ini_parser.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <pthread.h>
#include "Crypto.h"
#include "FS.h"
@ -131,6 +132,7 @@ namespace client @@ -131,6 +132,7 @@ namespace client
void I2PControlService::Run ()
{
pthread_setname_np(pthread_self(), "I2PC");
while (m_IsRunning)
{
try {

2
daemon/UPnP.cpp

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
#ifdef USE_UPNP
#include <string>
#include <thread>
#include <pthread.h>
#include <boost/thread/thread.hpp>
#include <boost/asio.hpp>
@ -60,6 +61,7 @@ namespace transport @@ -60,6 +61,7 @@ namespace transport
void UPnP::Run ()
{
pthread_setname_np(pthread_self(), "UPnP");
while (m_IsRunning)
{
try

2
libi2pd/Log.cpp

@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
*/
#include "Log.h"
#include <pthread.h>
//for std::transform
#include <algorithm>
@ -179,6 +180,7 @@ namespace log { @@ -179,6 +180,7 @@ namespace log {
void Log::Run ()
{
pthread_setname_np(pthread_self(), "Logging");
Reopen ();
while (m_IsRunning)
{

1
libi2pd/NTCP2.h

@ -11,7 +11,6 @@ @@ -11,7 +11,6 @@
#include <inttypes.h>
#include <memory>
#include <thread>
#include <list>
#include <map>
#include <array>

3
libi2pd/NetDb.cpp

@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
#include <vector>
#include <boost/asio.hpp>
#include <stdexcept>
#include <pthread.h>
#include "I2PEndian.h"
#include "Base.h"
@ -88,6 +89,8 @@ namespace data @@ -88,6 +89,8 @@ namespace data
void NetDb::Run ()
{
pthread_setname_np(pthread_self(), "NetDB");
uint32_t lastSave = 0, lastPublish = 0, lastExploratory = 0, lastManageRequest = 0, lastDestinationCleanup = 0;
while (m_IsRunning)
{

7
libi2pd/SSU.cpp

@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
*/
#include <string.h>
#include <pthread.h>
#include "Log.h"
#include "Timestamp.h"
#include "RouterContext.h"
@ -142,6 +143,8 @@ namespace transport @@ -142,6 +143,8 @@ namespace transport
void SSUServer::Run ()
{
pthread_setname_np(pthread_self(), "SSU");
while (m_IsRunning)
{
try
@ -157,6 +160,8 @@ namespace transport @@ -157,6 +160,8 @@ namespace transport
void SSUServer::RunReceivers ()
{
pthread_setname_np(pthread_self(), "SSUv4");
while (m_IsRunning)
{
try
@ -179,6 +184,8 @@ namespace transport @@ -179,6 +184,8 @@ namespace transport
void SSUServer::RunReceiversV6 ()
{
pthread_setname_np(pthread_self(), "SSUv6");
while (m_IsRunning)
{
try

2
libi2pd/Timestamp.cpp

@ -14,6 +14,7 @@ @@ -14,6 +14,7 @@
#include <future>
#include <boost/asio.hpp>
#include <boost/algorithm/string.hpp>
#include <pthread.h>
#include "Config.h"
#include "Log.h"
#include "I2PEndian.h"
@ -148,6 +149,7 @@ namespace util @@ -148,6 +149,7 @@ namespace util
void NTPTimeSync::Run ()
{
pthread_setname_np(pthread_self(), "Timesync");
while (m_IsRunning)
{
try

5
libi2pd/Transports.cpp

@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
* See full license text in LICENSE file at top of project tree
*/
#include <pthread.h>
#include "Log.h"
#include "Crypto.h"
#include "RouterContext.h"
@ -59,6 +60,8 @@ namespace transport @@ -59,6 +60,8 @@ namespace transport
template<typename Keys>
void EphemeralKeysSupplier<Keys>::Run ()
{
pthread_setname_np(pthread_self(), "Ephemerals");
while (m_IsRunning)
{
int num, total = 0;
@ -272,6 +275,8 @@ namespace transport @@ -272,6 +275,8 @@ namespace transport
void Transports::Run ()
{
pthread_setname_np(pthread_self(), "Transports");
while (m_IsRunning && m_Service)
{
try

2
libi2pd/Tunnel.cpp

@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
#include "I2PEndian.h"
#include <random>
#include <thread>
#include <pthread.h>
#include <algorithm>
#include <vector>
#include "Crypto.h"
@ -472,6 +473,7 @@ namespace tunnel @@ -472,6 +473,7 @@ namespace tunnel
void Tunnels::Run ()
{
pthread_setname_np(pthread_self(), "Tunnels");
std::this_thread::sleep_for (std::chrono::seconds(1)); // wait for other parts are ready
uint64_t lastTs = 0, lastPoolsTs = 0;

1
libi2pd/util.cpp

@ -94,6 +94,7 @@ namespace util @@ -94,6 +94,7 @@ namespace util
void RunnableService::Run ()
{
pthread_setname_np(pthread_self(), m_Name.c_str());
while (m_IsRunning)
{
try

1
libi2pd_client/AddressBook.cpp

@ -748,6 +748,7 @@ namespace client @@ -748,6 +748,7 @@ namespace client
void AddressBookSubscription::CheckUpdates ()
{
pthread_setname_np(pthread_self(), "Addressbook");
bool result = MakeRequest ();
m_Book.DownloadComplete (result, m_Ident, m_Etag, m_LastModified);
}

2
libi2pd_client/I2PTunnel.cpp

@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
*/
#include <cassert>
#include <pthread.h>
#include "Base.h"
#include "Log.h"
#include "Destination.h"
@ -941,6 +942,7 @@ namespace client @@ -941,6 +942,7 @@ namespace client
void I2PUDPClientTunnel::TryResolving() {
LogPrint(eLogInfo, "UDP Tunnel: Trying to resolve ", m_RemoteDest);
pthread_setname_np(pthread_self(), "UDP Resolver");
std::shared_ptr<const Address> addr;
while(!(addr = context.GetAddressBook().GetAddress(m_RemoteDest)) && !m_cancel_resolve)

Loading…
Cancel
Save