mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-31 04:44:13 +00:00
fixed race condition
This commit is contained in:
parent
feb26692d4
commit
92b96d9b15
@ -154,11 +154,14 @@ namespace tunnel
|
|||||||
else
|
else
|
||||||
block.deliveryType = eDeliveryTypeLocal;
|
block.deliveryType = eDeliveryTypeLocal;
|
||||||
block.data = msg;
|
block.data = msg;
|
||||||
|
|
||||||
|
std::unique_lock<std::mutex> l(m_SendMutex);
|
||||||
m_Gateway.SendTunnelDataMsg (block);
|
m_Gateway.SendTunnelDataMsg (block);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutboundTunnel::SendTunnelDataMsg (std::vector<TunnelMessageBlock> msgs)
|
void OutboundTunnel::SendTunnelDataMsg (std::vector<TunnelMessageBlock> msgs)
|
||||||
{
|
{
|
||||||
|
std::unique_lock<std::mutex> l(m_SendMutex);
|
||||||
for (auto& it : msgs)
|
for (auto& it : msgs)
|
||||||
m_Gateway.PutTunnelDataMsg (it);
|
m_Gateway.PutTunnelDataMsg (it);
|
||||||
m_Gateway.SendBuffer ();
|
m_Gateway.SendBuffer ();
|
||||||
|
2
Tunnel.h
2
Tunnel.h
@ -7,6 +7,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
#include <mutex>
|
||||||
#include <cryptopp/modes.h>
|
#include <cryptopp/modes.h>
|
||||||
#include <cryptopp/aes.h>
|
#include <cryptopp/aes.h>
|
||||||
#include "Queue.h"
|
#include "Queue.h"
|
||||||
@ -83,6 +84,7 @@ namespace tunnel
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
std::mutex m_SendMutex;
|
||||||
TunnelGateway m_Gateway;
|
TunnelGateway m_Gateway;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user