Browse Source

create/delete stream per destination only

pull/102/head
orignal 10 years ago
parent
commit
18d6a2c70e
  1. 22
      Destination.cpp
  2. 4
      Destination.h
  3. 4
      HTTPServer.cpp
  4. 4
      I2PTunnel.cpp
  5. 4
      SAM.cpp
  6. 2
      SOCKS.cpp

22
Destination.cpp

@ -453,18 +453,6 @@ namespace stream @@ -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 @@ -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 ();

4
Destination.h

@ -100,8 +100,6 @@ namespace stream @@ -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 @@ -125,8 +123,6 @@ namespace stream
};
Stream * CreateStream (const i2p::data::LeaseSet& remote);
void DeleteStream (Stream * stream);
void StartStreaming ();
void StopStreaming ();
StreamingDestination * GetSharedLocalDestination ();

4
HTTPServer.cpp

@ -516,7 +516,7 @@ namespace util @@ -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 @@ -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);

4
I2PTunnel.cpp

@ -38,7 +38,7 @@ namespace stream @@ -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 @@ -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;
}
}

4
SAM.cpp

@ -24,7 +24,7 @@ namespace stream @@ -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 @@ -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)

2
SOCKS.cpp

@ -223,7 +223,7 @@ namespace proxy @@ -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();

Loading…
Cancel
Save