mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
save out-of-seq messages and process them later
This commit is contained in:
parent
ae51b11ced
commit
27426a6023
2 changed files with 45 additions and 3 deletions
15
Streaming.h
15
Streaming.h
|
@ -3,7 +3,9 @@
|
|||
|
||||
#include <inttypes.h>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <cryptopp/dsa.h>
|
||||
#include "I2PEndian.h"
|
||||
#include "Queue.h"
|
||||
#include "Identity.h"
|
||||
#include "LeaseSet.h"
|
||||
|
@ -37,6 +39,16 @@ namespace stream
|
|||
Packet (): len (0), offset (0) {};
|
||||
uint8_t * GetBuffer () { return buf + offset; };
|
||||
size_t GetLength () const { return len - offset; };
|
||||
|
||||
uint32_t GetReceivedSeqn () const { return be32toh (*(uint32_t *)(buf + 8)); };
|
||||
};
|
||||
|
||||
struct PacketCmp
|
||||
{
|
||||
bool operator() (const Packet * p1, const Packet * p2) const
|
||||
{
|
||||
return p1->GetReceivedSeqn () < p2->GetReceivedSeqn ();
|
||||
};
|
||||
};
|
||||
|
||||
class StreamingDestination;
|
||||
|
@ -61,6 +73,8 @@ namespace stream
|
|||
|
||||
void ConnectAndSend (uint8_t * buf, size_t len);
|
||||
void SendQuickAck ();
|
||||
|
||||
void SavePacket (Packet * packet);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -69,6 +83,7 @@ namespace stream
|
|||
StreamingDestination * m_LocalDestination;
|
||||
const i2p::data::LeaseSet * m_RemoteLeaseSet;
|
||||
i2p::util::Queue<Packet> m_ReceiveQueue;
|
||||
std::set<Packet *, PacketCmp> m_SavedPackets;
|
||||
i2p::tunnel::OutboundTunnel * m_OutboundTunnel;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue