fix send buffer issue

This commit is contained in:
lhodges1 2023-08-23 22:40:44 +10:00
parent d94ee8ee61
commit 5a4870515a

View file

@ -33,16 +33,16 @@ void global::Client::ServerSend(PVOID Buffer, SIZE_T Size, INT RequestId)
if ( Size > ( SEND_BUFFER_SIZE - total_size_of_headers ) )
{
INT total_packets = std::ceil( Size / ( SEND_BUFFER_SIZE - total_size_of_headers ) );
LONG remaining_bytes = Size;
LONG remaining_bytes = Size + total_packets * total_size_of_headers;
for ( INT count = 0; count < total_packets; count++ )
for ( INT count = 0; count < total_packets + 1; count++ )
{
global::headers::PIPE_PACKET_SEND_EXTENSION_HEADER header_extension;
header_extension.request_id = RequestId;
header_extension.total_incoming_packet_count = total_packets;
header_extension.total_incoming_packet_size = Size;
header_extension.current_packet_number = count;
header_extension.packet_size = ( count + 1 ) == total_packets ? remaining_bytes : SEND_BUFFER_SIZE;
header_extension.packet_size = count == total_packets ? remaining_bytes : SEND_BUFFER_SIZE;
LOG_INFO( "current packet number: %lx, packet size: %lx", header_extension.current_packet_number, header_extension.packet_size );
@ -56,6 +56,7 @@ void global::Client::ServerSend(PVOID Buffer, SIZE_T Size, INT RequestId)
this->pipe->WriteToPipe( this->send_buffer, header_extension.packet_size );
LOG_INFO( "remainiong bytes: %lx", remaining_bytes );
remaining_bytes = remaining_bytes - header_extension.packet_size;
}
}