Browse Source

invoke acceptor on reset

pull/151/head
orignal 10 years ago
parent
commit
2c2acae50d
  1. 5
      SAM.cpp
  2. 2
      Streaming.h

5
SAM.cpp

@ -573,6 +573,8 @@ namespace client
else else
I2PReceive (); I2PReceive ();
} }
else
LogPrint (eLogInfo, "SAM I2P acceptor has been reset");
} }
void SAMSocket::HandleI2PDatagramReceive (const i2p::data::IdentityEx& ident, const uint8_t * buf, size_t len) void SAMSocket::HandleI2PDatagramReceive (const i2p::data::IdentityEx& ident, const uint8_t * buf, size_t len)
@ -709,7 +711,7 @@ namespace client
// TODO: extract string values // TODO: extract string values
signatureType = boost::lexical_cast<int> (it->second); signatureType = boost::lexical_cast<int> (it->second);
} }
localDestination = i2p::client::context.CreateNewLocalDestination (false, signatureType, params); localDestination = i2p::client::context.CreateNewLocalDestination (true, signatureType, params);
} }
if (localDestination) if (localDestination)
{ {
@ -729,6 +731,7 @@ namespace client
if (it != m_Sessions.end ()) if (it != m_Sessions.end ())
{ {
auto session = it->second; auto session = it->second;
session->localDestination->StopAcceptingStreams ();
session->CloseStreams (); session->CloseStreams ();
m_Sessions.erase (it); m_Sessions.erase (it);
delete session; delete session;

2
Streaming.h

@ -180,7 +180,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);
void SetAcceptor (const Acceptor& acceptor) { m_Acceptor = acceptor; }; void SetAcceptor (const Acceptor& acceptor) { m_Acceptor = acceptor; };
void ResetAcceptor () { m_Acceptor = nullptr; }; void ResetAcceptor () { if (m_Acceptor) m_Acceptor (nullptr); m_Acceptor = nullptr; };
bool IsAcceptorSet () const { return m_Acceptor != nullptr; }; bool IsAcceptorSet () const { return m_Acceptor != nullptr; };
i2p::client::ClientDestination& GetOwner () { return m_Owner; }; i2p::client::ClientDestination& GetOwner () { return m_Owner; };

Loading…
Cancel
Save