Browse Source

Destinations: set thread name from tunnel name

Signed-off-by: r4sas <r4sas@i2pmail.org>
pull/2094/merge
R4SAS 2 weeks ago
parent
commit
574d12298b
Signed by: r4sas
GPG Key ID: 66F6C87B98EBCFE2
  1. 2
      libi2pd/Destination.cpp
  2. 2
      libi2pd/util.h
  3. 15
      libi2pd_client/ClientContext.cpp

2
libi2pd/Destination.cpp

@ -1517,6 +1517,8 @@ namespace client @@ -1517,6 +1517,8 @@ namespace client
RunnableService ("Destination"),
ClientDestination (GetIOService (), keys, isPublic, params)
{
if (!GetNickname ().empty ())
RunnableService::SetName (GetNickname ());
}
RunnableClientDestination::~RunnableClientDestination ()

2
libi2pd/util.h

@ -183,6 +183,8 @@ namespace util @@ -183,6 +183,8 @@ namespace util
void StartIOService ();
void StopIOService ();
void SetName (std::string_view name) { m_Name = name; };
private:
void Run ();

15
libi2pd_client/ClientContext.cpp

@ -421,7 +421,8 @@ namespace client @@ -421,7 +421,8 @@ namespace client
{ I2CP_PARAM_INBOUND_TUNNELS_QUANTITY, "3" },
{ I2CP_PARAM_OUTBOUND_TUNNELS_QUANTITY, "3" },
{ I2CP_PARAM_LEASESET_TYPE, "3" },
{ I2CP_PARAM_LEASESET_ENCRYPTION_TYPE, "0,4" }
{ I2CP_PARAM_LEASESET_ENCRYPTION_TYPE, "0,4" },
{ I2CP_PARAM_OUTBOUND_NICKNAME, "SharedDest" }
};
m_SharedLocalDestination = CreateNewLocalDestination (false, i2p::data::SIGNING_KEY_TYPE_EDDSA_SHA512_ED25519,
i2p::data::CRYPTO_KEY_TYPE_ELGAMAL, &params); // non-public, EDDSA
@ -596,6 +597,11 @@ namespace client @@ -596,6 +597,11 @@ namespace client
std::map<std::string, std::string> options;
ReadI2CPOptions (section, false, options);
// Set I2CP name if not set
auto itopt = options.find (I2CP_PARAM_OUTBOUND_NICKNAME);
if (itopt == options.end ())
options[I2CP_PARAM_OUTBOUND_NICKNAME] = name;
std::shared_ptr<ClientDestination> localDestination = nullptr;
if (keys.length () > 0)
{
@ -750,6 +756,11 @@ namespace client @@ -750,6 +756,11 @@ namespace client
std::map<std::string, std::string> options;
ReadI2CPOptions (section, true, options);
// Set I2CP name if not set
auto itopt = options.find (I2CP_PARAM_INBOUND_NICKNAME);
if (itopt == options.end ())
options[I2CP_PARAM_INBOUND_NICKNAME] = name;
std::shared_ptr<ClientDestination> localDestination = nullptr;
auto it = destinations.find (keys);
if (it != destinations.end ())
@ -897,6 +908,7 @@ namespace client @@ -897,6 +908,7 @@ namespace client
{
std::map<std::string, std::string> params;
ReadI2CPOptionsFromConfig ("httpproxy.", params);
params[I2CP_PARAM_OUTBOUND_NICKNAME] = "HTTPProxy";
localDestination = CreateNewLocalDestination (keys, false, &params);
if (localDestination) localDestination->Acquire ();
}
@ -945,6 +957,7 @@ namespace client @@ -945,6 +957,7 @@ namespace client
{
std::map<std::string, std::string> params;
ReadI2CPOptionsFromConfig ("socksproxy.", params);
params[I2CP_PARAM_OUTBOUND_NICKNAME] = "SOCKSProxy";
localDestination = CreateNewLocalDestination (keys, false, &params);
if (localDestination) localDestination->Acquire ();
}

Loading…
Cancel
Save