mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-02 06:54:15 +00:00
process extended data
This commit is contained in:
parent
275155998f
commit
05d869254d
33
SSUData.cpp
33
SSUData.cpp
@ -39,12 +39,8 @@ namespace ssu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SSUData::ProcessMessage (uint8_t * buf, size_t len)
|
void SSUData::ProcessAcks (uint8_t *& buf, uint8_t flag)
|
||||||
{
|
{
|
||||||
//uint8_t * start = buf;
|
|
||||||
uint8_t flag = *buf;
|
|
||||||
buf++;
|
|
||||||
LogPrint ("Process SSU data flags=", (int)flag);
|
|
||||||
if (flag & DATA_FLAG_EXPLICIT_ACKS_INCLUDED)
|
if (flag & DATA_FLAG_EXPLICIT_ACKS_INCLUDED)
|
||||||
{
|
{
|
||||||
// explicit ACKs
|
// explicit ACKs
|
||||||
@ -83,7 +79,7 @@ namespace ssu
|
|||||||
{
|
{
|
||||||
if (fragment < numSentFragments)
|
if (fragment < numSentFragments)
|
||||||
{
|
{
|
||||||
delete it->second[fragment];
|
delete[] it->second[fragment];
|
||||||
it->second[fragment] = nullptr;
|
it->second[fragment] = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -96,6 +92,10 @@ namespace ssu
|
|||||||
while (isNonLast);
|
while (isNonLast);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SSUData::ProcessFragments (uint8_t * buf)
|
||||||
|
{
|
||||||
uint8_t numFragments = *buf; // number of fragments
|
uint8_t numFragments = *buf; // number of fragments
|
||||||
buf++;
|
buf++;
|
||||||
for (int i = 0; i < numFragments; i++)
|
for (int i = 0; i < numFragments; i++)
|
||||||
@ -208,6 +208,27 @@ namespace ssu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SSUData::ProcessMessage (uint8_t * buf, size_t len)
|
||||||
|
{
|
||||||
|
//uint8_t * start = buf;
|
||||||
|
uint8_t flag = *buf;
|
||||||
|
buf++;
|
||||||
|
LogPrint ("Process SSU data flags=", (int)flag);
|
||||||
|
// process acks if presented
|
||||||
|
if (flag & (DATA_FLAG_ACK_BITFIELDS_INCLUDED | DATA_FLAG_EXPLICIT_ACKS_INCLUDED))
|
||||||
|
ProcessAcks (buf, flag);
|
||||||
|
// extended data if presented
|
||||||
|
if (flag & DATA_FLAG_EXTENDED_DATA_INCLUDED)
|
||||||
|
{
|
||||||
|
uint8_t extendedDataSize = *buf;
|
||||||
|
buf++; // size
|
||||||
|
LogPrint ("SSU extended data of ", extendedDataSize, " bytes presented");
|
||||||
|
buf += extendedDataSize;
|
||||||
|
}
|
||||||
|
// process data
|
||||||
|
ProcessFragments (buf);
|
||||||
|
}
|
||||||
|
|
||||||
void SSUData::Send (i2p::I2NPMessage * msg)
|
void SSUData::Send (i2p::I2NPMessage * msg)
|
||||||
{
|
{
|
||||||
uint32_t msgID = msg->ToSSU ();
|
uint32_t msgID = msg->ToSSU ();
|
||||||
|
@ -65,6 +65,8 @@ namespace ssu
|
|||||||
|
|
||||||
void SendMsgAck (uint32_t msgID);
|
void SendMsgAck (uint32_t msgID);
|
||||||
void SendFragmentAck (uint32_t msgID, int fragmentNum);
|
void SendFragmentAck (uint32_t msgID, int fragmentNum);
|
||||||
|
void ProcessAcks (uint8_t *& buf, uint8_t flag);
|
||||||
|
void ProcessFragments (uint8_t * buf);
|
||||||
void ProcessSentMessageAck (uint32_t msgID);
|
void ProcessSentMessageAck (uint32_t msgID);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user