create/delete stream per destination only

This commit is contained in:
orignal 2014-10-15 18:24:40 -04:00
parent 341e860caa
commit 18d6a2c70e
6 changed files with 7 additions and 33 deletions

View File

@ -453,18 +453,6 @@ namespace stream
localDestination->Start ();
return localDestination;
}
Stream * StreamingDestinations::CreateClientStream (const i2p::data::LeaseSet& remote)
{
if (!m_SharedLocalDestination) return nullptr;
return m_SharedLocalDestination->CreateNewOutgoingStream (remote);
}
void StreamingDestinations::DeleteStream (Stream * stream)
{
if (stream)
stream->GetLocalDestination ().DeleteStream (stream);
}
StreamingDestination * StreamingDestinations::FindLocalDestination (const i2p::data::IdentHash& destination) const
{
@ -474,16 +462,6 @@ namespace stream
return nullptr;
}
Stream * CreateStream (const i2p::data::LeaseSet& remote)
{
return destinations.CreateClientStream (remote);
}
void DeleteStream (Stream * stream)
{
destinations.DeleteStream (stream);
}
void StartStreaming ()
{
destinations.Start ();

View File

@ -100,8 +100,6 @@ namespace stream
void Start ();
void Stop ();
Stream * CreateClientStream (const i2p::data::LeaseSet& remote);
void DeleteStream (Stream * stream);
StreamingDestination * GetSharedLocalDestination () const { return m_SharedLocalDestination; };
StreamingDestination * CreateNewLocalDestination (bool isPublic, i2p::data::SigningKeyType sigType);
StreamingDestination * CreateNewLocalDestination (const i2p::data::PrivateKeys& keys, bool isPublic);
@ -125,8 +123,6 @@ namespace stream
};
Stream * CreateStream (const i2p::data::LeaseSet& remote);
void DeleteStream (Stream * stream);
void StartStreaming ();
void StopStreaming ();
StreamingDestination * GetSharedLocalDestination ();

View File

@ -516,7 +516,7 @@ namespace util
if (m_Stream)
{
m_Stream->Close ();
DeleteStream (m_Stream);
i2p::stream::GetSharedLocalDestination ()->DeleteStream (m_Stream);
m_Stream = nullptr;
}
m_Socket->close ();
@ -868,7 +868,7 @@ namespace util
}
}
if (!m_Stream)
m_Stream = i2p::stream::CreateStream (*leaseSet);
m_Stream = i2p::stream::GetSharedLocalDestination ()->CreateNewOutgoingStream (*leaseSet);
if (m_Stream)
{
m_Stream->Send ((uint8_t *)buf, len);

View File

@ -38,7 +38,7 @@ namespace stream
if (m_Stream)
{
m_Stream->Close ();
DeleteStream (m_Stream);
m_Owner->GetLocalDestination ()->DeleteStream (m_Stream);
m_Stream = nullptr;
}
m_Socket->close ();
@ -114,7 +114,7 @@ namespace stream
if (ecode != boost::asio::error::operation_aborted)
{
if (m_Stream) m_Stream->Close ();
DeleteStream (m_Stream);
m_Owner->GetLocalDestination ()->DeleteStream (m_Stream);
m_Stream = nullptr;
}
}

View File

@ -24,7 +24,7 @@ namespace stream
if (m_Stream)
{
m_Stream->Close ();
DeleteStream (m_Stream);
m_Session->localDestination->DeleteStream (m_Stream);
}
}
@ -33,7 +33,7 @@ namespace stream
if (m_Stream)
{
m_Stream->Close ();
DeleteStream (m_Stream);
m_Session->localDestination->DeleteStream (m_Stream);
m_Stream = nullptr;
}
switch (m_SocketType)

View File

@ -223,7 +223,7 @@ namespace proxy
void SOCKS4AHandler::SentConnectionSuccess(const boost::system::error_code & ecode)
{
LogPrint("--- socks4a making connection");
m_stream = i2p::stream::CreateStream(*m_ls);
m_stream = i2p::stream::GetSharedLocalDestination ()->CreateNewOutgoingStream(*m_ls);
m_state = OKAY;
LogPrint("--- socks4a state is ", m_state);
AsyncSockRead();