mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2024-11-04 06:00:37 +00:00
look for LeaseSet in shared local destination
This commit is contained in:
parent
993b4c92b0
commit
c009fc5d72
@ -337,12 +337,12 @@ namespace client
|
|||||||
i2p::data::IdentHash ident;
|
i2p::data::IdentHash ident;
|
||||||
if (m_Book.GetIdentHash (u.host_, ident))
|
if (m_Book.GetIdentHash (u.host_, ident))
|
||||||
{
|
{
|
||||||
auto leaseSet = i2p::data::netdb.FindLeaseSet (ident);
|
const i2p::data::LeasetSet * leaseSet = i2p::data::netdb.FindLeaseSet (ident);
|
||||||
if (!leaseSet)
|
if (!leaseSet)
|
||||||
{
|
{
|
||||||
i2p::data::netdb.RequestDestination (ident, true, i2p::client::context.GetSharedLocalDestination ()->GetTunnelPool ());
|
i2p::data::netdb.RequestDestination (ident, true, i2p::client::context.GetSharedLocalDestination ()->GetTunnelPool ());
|
||||||
std::this_thread::sleep_for (std::chrono::seconds (5)); // wait for 5 seconds
|
std::this_thread::sleep_for (std::chrono::seconds (5)); // wait for 5 seconds
|
||||||
leaseSet = i2p::data::netdb.FindLeaseSet (ident);
|
leaseSet = i2p::client::context.GetSharedLocalDestination ()->FindLeaseSet (ident);
|
||||||
}
|
}
|
||||||
if (leaseSet)
|
if (leaseSet)
|
||||||
{
|
{
|
||||||
@ -359,6 +359,7 @@ namespace client
|
|||||||
{
|
{
|
||||||
std::condition_variable newDataReceived;
|
std::condition_variable newDataReceived;
|
||||||
std::mutex newDataReceivedMutex;
|
std::mutex newDataReceivedMutex;
|
||||||
|
std::unique_lock<std::mutex> l(newDataReceivedMutex);
|
||||||
stream->AsyncReceive (boost::asio::buffer (buf, 4096),
|
stream->AsyncReceive (boost::asio::buffer (buf, 4096),
|
||||||
[&](const boost::system::error_code& ecode, std::size_t bytes_transferred)
|
[&](const boost::system::error_code& ecode, std::size_t bytes_transferred)
|
||||||
{
|
{
|
||||||
@ -369,7 +370,6 @@ namespace client
|
|||||||
newDataReceived.notify_one ();
|
newDataReceived.notify_one ();
|
||||||
},
|
},
|
||||||
30); // wait for 30 seconds
|
30); // wait for 30 seconds
|
||||||
std::unique_lock<std::mutex> l(newDataReceivedMutex);
|
|
||||||
newDataReceived.wait (l);
|
newDataReceived.wait (l);
|
||||||
if (!end)
|
if (!end)
|
||||||
end = !stream->IsOpen ();
|
end = !stream->IsOpen ();
|
||||||
|
Loading…
Reference in New Issue
Block a user