mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2024-11-16 00:12:43 +00:00
delete stream by id for HTTP interface
This commit is contained in:
parent
8dae044600
commit
1e9a53da3f
@ -1191,6 +1191,16 @@ namespace client
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ClientDestination::DeleteStream (uint32_t recvStreamID)
|
||||||
|
{
|
||||||
|
if (m_StreamingDestination->DeleteStream (recvStreamID))
|
||||||
|
return true;
|
||||||
|
for (auto it: m_StreamingDestinationsByPorts)
|
||||||
|
if (it.second->DeleteStream (recvStreamID))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
RunnableClientDestination::RunnableClientDestination (const i2p::data::PrivateKeys& keys, bool isPublic, const std::map<std::string, std::string> * params):
|
RunnableClientDestination::RunnableClientDestination (const i2p::data::PrivateKeys& keys, bool isPublic, const std::map<std::string, std::string> * params):
|
||||||
RunnableService ("Destination"),
|
RunnableService ("Destination"),
|
||||||
ClientDestination (GetIOService (), keys, isPublic, params)
|
ClientDestination (GetIOService (), keys, isPublic, params)
|
||||||
|
@ -281,6 +281,7 @@ namespace client
|
|||||||
|
|
||||||
// for HTTP only
|
// for HTTP only
|
||||||
std::vector<std::shared_ptr<const i2p::stream::Stream> > GetAllStreams () const;
|
std::vector<std::shared_ptr<const i2p::stream::Stream> > GetAllStreams () const;
|
||||||
|
bool DeleteStream (uint32_t recvStreamID);
|
||||||
};
|
};
|
||||||
|
|
||||||
class RunnableClientDestination: private i2p::util::RunnableService, public ClientDestination
|
class RunnableClientDestination: private i2p::util::RunnableService, public ClientDestination
|
||||||
|
@ -1128,6 +1128,15 @@ namespace stream
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool StreamingDestination::DeleteStream (uint32_t recvStreamID)
|
||||||
|
{
|
||||||
|
auto it = m_Streams.find (recvStreamID);
|
||||||
|
if (it == m_Streams.end ())
|
||||||
|
return false;
|
||||||
|
DeleteStream (it->second);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void StreamingDestination::SetAcceptor (const Acceptor& acceptor)
|
void StreamingDestination::SetAcceptor (const Acceptor& acceptor)
|
||||||
{
|
{
|
||||||
m_Acceptor = acceptor; // we must set it immediately for IsAcceptorSet
|
m_Acceptor = acceptor; // we must set it immediately for IsAcceptorSet
|
||||||
|
@ -250,6 +250,7 @@ namespace stream
|
|||||||
|
|
||||||
std::shared_ptr<Stream> CreateNewOutgoingStream (std::shared_ptr<const i2p::data::LeaseSet> remote, int port = 0);
|
std::shared_ptr<Stream> CreateNewOutgoingStream (std::shared_ptr<const i2p::data::LeaseSet> remote, int port = 0);
|
||||||
void DeleteStream (std::shared_ptr<Stream> stream);
|
void DeleteStream (std::shared_ptr<Stream> stream);
|
||||||
|
bool DeleteStream (uint32_t recvStreamID);
|
||||||
void SetAcceptor (const Acceptor& acceptor);
|
void SetAcceptor (const Acceptor& acceptor);
|
||||||
void ResetAcceptor ();
|
void ResetAcceptor ();
|
||||||
bool IsAcceptorSet () const { return m_Acceptor != nullptr; };
|
bool IsAcceptorSet () const { return m_Acceptor != nullptr; };
|
||||||
|
Loading…
Reference in New Issue
Block a user