Skip to content

added LocalDestinationInfo I2PControl request - #2486

Merged
orignal merged 3 commits into
PurpleI2P:opensslfrom
pobregat0:local-destination-info
Aug 17, 2026
Merged

added LocalDestinationInfo I2PControl request#2486
orignal merged 3 commits into
PurpleI2P:opensslfrom
pobregat0:local-destination-info

Conversation

@pobregat0

Copy link
Copy Markdown
Contributor

Fix for #1820

LocalDestinationInfo returns the leasesets a local destination knows and the
streams it has open, so a service with several tunnels can see how loaded each
one is. The destination is given by its address, name to address mapping is
already there in ClientServicesInfo.

GetAllStreams now copies the map under the existing m_StreamsMutex, the list is
walked from another thread while streams are created and deleted. Checked with
thread sanitizer on a live router, 28808 requests while streams came and went:
without the lock it reports a race between the walk and the map, with the lock
there is none.

Both lists come back as JSON arrays and stay arrays when empty. Missing, empty
and malformed addresses answer with an error and no crash.

Comment thread libi2pd/Destination.h
int GetNumRemoteLeaseSets () const { return m_RemoteLeaseSets.size (); };
const decltype(m_RemoteLeaseSets)& GetLeaseSets () const { return m_RemoteLeaseSets; };
// copy for other threads, unlike GetLeaseSets which hands out the container itself
std::vector<std::shared_ptr<i2p::data::LeaseSet> > GetLeaseSetsList () const

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Новый метод, до этого не существующий

Comment thread libi2pd/Streaming.h Outdated
const decltype(m_Streams)& GetStreams () const { return m_Streams; };

// copy for other threads, unlike GetStreams which hands out the map itself
void GetStreamsList (std::vector<std::shared_ptr<const Stream> >& streams)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Новый метод до этого не существующий

Comment thread libi2pd/Destination.cpp Outdated
for (auto& it: m_StreamingDestination->GetStreams ())
ret.push_back (it.second);
}
m_StreamingDestination->GetStreamsList (ret);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wipedlifepotato wipedlifepotato Aug 17, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Новый vector создается, через новый метод и переменная ссылается на него. Добавлен мьютекс

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Безопасно ли выводить все свои лизсеты
данного метода нет в java. Оно локально вызывается или может быть вызвано извне?

Comment thread daemon/I2PControl.cpp

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Безопасно ли выводить все свои лизсеты
данного метода нет в java. Оно локально вызывается или может быть вызвано извне?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I2PControl всегда локальный

@wipedlifepotato

Copy link
Copy Markdown
Contributor

а так ок вродь

Comment thread libi2pd/Streaming.h Outdated
const decltype(m_Streams)& GetStreams () const { return m_Streams; };

// copy for other threads, unlike GetStreams which hands out the map itself
void GetStreamsList (std::vector<std::shared_ptr<const Stream> >& streams)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лучше этот вектор возвращать чем передавать на него ссылку.

@pobregat0
pobregat0 force-pushed the local-destination-info branch from 8164d89 to 37acd98 Compare August 17, 2026 00:35
@orignal
orignal merged commit a5d5eab into PurpleI2P:openssl Aug 17, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants