Destinations: set thread name from tunnel name

Signed-off-by: r4sas <r4sas@i2pmail.org>
This commit is contained in:
r4sas 2024-11-12 00:36:07 +03:00
parent 7285caa4f1
commit 574d12298b
No known key found for this signature in database
GPG key ID: 66F6C87B98EBCFE2
3 changed files with 48 additions and 31 deletions

View file

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

View file

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

View file

@ -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
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
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
{
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
{
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 ();
}