Browse Source

use shared_ptr for transit tunnel participant

pull/210/head
orignal 10 years ago
parent
commit
122b8c2a84
  1. 4
      TransitTunnel.cpp
  2. 3
      TransitTunnel.h

4
TransitTunnel.cpp

@ -27,8 +27,6 @@ namespace tunnel @@ -27,8 +27,6 @@ namespace tunnel
TransitTunnelParticipant::~TransitTunnelParticipant ()
{
for (auto it: m_TunnelDataMsgs)
i2p::DeleteI2NPMessage (it);
}
void TransitTunnelParticipant::HandleTunnelDataMsg (i2p::I2NPMessage * tunnelMsg)
@ -38,7 +36,7 @@ namespace tunnel @@ -38,7 +36,7 @@ namespace tunnel
m_NumTransmittedBytes += tunnelMsg->GetLength ();
htobe32buf (tunnelMsg->GetPayload (), GetNextTunnelID ());
FillI2NPMessageHeader (tunnelMsg, eI2NPTunnelData);
m_TunnelDataMsgs.push_back (tunnelMsg);
m_TunnelDataMsgs.push_back (ToSharedI2NPMessage (tunnelMsg));
}
void TransitTunnelParticipant::FlushTunnelDataMsgs ()

3
TransitTunnel.h

@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
#include <inttypes.h>
#include <vector>
#include <mutex>
#include <memory>
#include "aes.h"
#include "I2NPProtocol.h"
#include "TunnelEndpoint.h"
@ -59,7 +60,7 @@ namespace tunnel @@ -59,7 +60,7 @@ namespace tunnel
private:
size_t m_NumTransmittedBytes;
std::vector<i2p::I2NPMessage *> m_TunnelDataMsgs;
std::vector<std::shared_ptr<i2p::I2NPMessage> > m_TunnelDataMsgs;
};
class TransitTunnelGateway: public TransitTunnel

Loading…
Cancel
Save