mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-10 05:11:10 +00:00
check max buffer size in Stream::Send
This commit is contained in:
parent
43a751ee0b
commit
b3b38015c2
@ -378,9 +378,15 @@ namespace stream
|
|||||||
|
|
||||||
size_t Stream::Send (const uint8_t * buf, size_t len)
|
size_t Stream::Send (const uint8_t * buf, size_t len)
|
||||||
{
|
{
|
||||||
// TODO: check max buffer size
|
size_t sent = len;
|
||||||
|
while(len > MAX_PACKET_SIZE)
|
||||||
|
{
|
||||||
|
AsyncSend (buf, MAX_PACKET_SIZE, nullptr);
|
||||||
|
buf += MAX_PACKET_SIZE;
|
||||||
|
len -= MAX_PACKET_SIZE;
|
||||||
|
}
|
||||||
AsyncSend (buf, len, nullptr);
|
AsyncSend (buf, len, nullptr);
|
||||||
return len;
|
return sent;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stream::AsyncSend (const uint8_t * buf, size_t len, SendHandler handler)
|
void Stream::AsyncSend (const uint8_t * buf, size_t len, SendHandler handler)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user