notify inbound tunnels update

This commit is contained in:
orignal 2014-08-15 19:21:30 -04:00
parent eff3bb6ab1
commit 29243fcb47
5 changed files with 28 additions and 14 deletions

View file

@ -575,22 +575,30 @@ namespace stream
const i2p::data::LeaseSet * StreamingDestination::GetLeaseSet ()
{
if (!m_Pool) return nullptr;
if (!m_LeaseSet || m_LeaseSet->HasExpiredLeases ())
{
auto newLeaseSet = new i2p::data::LeaseSet (*m_Pool);
if (!m_LeaseSet)
m_LeaseSet = newLeaseSet;
else
{
// TODO: implement it better
*m_LeaseSet = *newLeaseSet;
delete newLeaseSet;
}
for (auto it: m_Streams)
it.second->SetLeaseSetUpdated ();
}
if (!m_LeaseSet)
UpdateLeaseSet ();
return m_LeaseSet;
}
void StreamingDestination::UpdateLeaseSet ()
{
auto newLeaseSet = new i2p::data::LeaseSet (*m_Pool);
if (!m_LeaseSet)
m_LeaseSet = newLeaseSet;
else
{
// TODO: implement it better
*m_LeaseSet = *newLeaseSet;
delete newLeaseSet;
}
}
void StreamingDestination::SetLeaseSetUpdated ()
{
UpdateLeaseSet ();
for (auto it: m_Streams)
it.second->SetLeaseSetUpdated ();
}
void StreamingDestination::Sign (const uint8_t * buf, int len, uint8_t * signature) const
{