mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-11 17:37:53 +00:00
fixed race condition
This commit is contained in:
parent
93857b690a
commit
b11fd250c1
@ -82,7 +82,7 @@ namespace i2p
|
|||||||
|
|
||||||
I2NPMessage * CreateDeliveryStatusMsg (uint32_t msgID)
|
I2NPMessage * CreateDeliveryStatusMsg (uint32_t msgID)
|
||||||
{
|
{
|
||||||
I2NPMessage * m = NewI2NPMessage ();
|
I2NPMessage * m = NewI2NPShortMessage ();
|
||||||
uint8_t * buf = m->GetPayload ();
|
uint8_t * buf = m->GetPayload ();
|
||||||
if (msgID)
|
if (msgID)
|
||||||
{
|
{
|
||||||
|
10
NetDb.cpp
10
NetDb.cpp
@ -131,7 +131,7 @@ namespace data
|
|||||||
if (msg)
|
if (msg)
|
||||||
{
|
{
|
||||||
int numMsgs = 0;
|
int numMsgs = 0;
|
||||||
while (msg && numMsgs < 500)
|
while (msg)
|
||||||
{
|
{
|
||||||
switch (msg->GetTypeID ())
|
switch (msg->GetTypeID ())
|
||||||
{
|
{
|
||||||
@ -151,6 +151,7 @@ namespace data
|
|||||||
LogPrint ("NetDb: unexpected message type ", msg->GetTypeID ());
|
LogPrint ("NetDb: unexpected message type ", msg->GetTypeID ());
|
||||||
i2p::HandleI2NPMessage (msg);
|
i2p::HandleI2NPMessage (msg);
|
||||||
}
|
}
|
||||||
|
if (numMsgs > 100) break;
|
||||||
msg = m_Queue.Get ();
|
msg = m_Queue.Get ();
|
||||||
numMsgs++;
|
numMsgs++;
|
||||||
}
|
}
|
||||||
@ -572,12 +573,12 @@ namespace data
|
|||||||
auto pool = i2p::tunnel::tunnels.GetExploratoryPool ();
|
auto pool = i2p::tunnel::tunnels.GetExploratoryPool ();
|
||||||
auto outbound = pool ? pool->GetNextOutboundTunnel () : nullptr;
|
auto outbound = pool ? pool->GetNextOutboundTunnel () : nullptr;
|
||||||
auto inbound = pool ? pool->GetNextInboundTunnel () : nullptr;
|
auto inbound = pool ? pool->GetNextInboundTunnel () : nullptr;
|
||||||
std::vector<i2p::tunnel::TunnelMessageBlock> msgs;
|
|
||||||
if (!dest->IsExploratory ())
|
if (!dest->IsExploratory ())
|
||||||
{
|
{
|
||||||
// reply to our destination. Try other floodfills
|
// reply to our destination. Try other floodfills
|
||||||
if (outbound && inbound )
|
if (outbound && inbound )
|
||||||
{
|
{
|
||||||
|
std::vector<i2p::tunnel::TunnelMessageBlock> msgs;
|
||||||
auto count = dest->GetExcludedPeers ().size ();
|
auto count = dest->GetExcludedPeers ().size ();
|
||||||
if (count < 7)
|
if (count < 7)
|
||||||
{
|
{
|
||||||
@ -605,11 +606,12 @@ namespace data
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
LogPrint (key, " was not found on 7 floodfills");
|
LogPrint (key, " was not found on 7 floodfills");
|
||||||
|
|
||||||
|
if (msgs.size () > 0)
|
||||||
|
outbound->SendTunnelDataMsg (msgs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outbound && msgs.size () > 0)
|
|
||||||
outbound->SendTunnelDataMsg (msgs);
|
|
||||||
if (deleteDest)
|
if (deleteDest)
|
||||||
{
|
{
|
||||||
// no more requests for the destinationation. delete it
|
// no more requests for the destinationation. delete it
|
||||||
|
Loading…
Reference in New Issue
Block a user