Skip to content

Commit

Permalink
Avoid junk network traffic and RAM usage
Browse files Browse the repository at this point in the history
Reset buffer counter for reused server commands.
  • Loading branch information
vilarion committed Jul 10, 2022
1 parent 8b8e2bc commit c98954d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/netinterface/BasicServerCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ BasicServerCommand::BasicServerCommand(unsigned char defByte, uint16_t bsize)
}

void BasicServerCommand::initHeader() {
bufferPos = 0; // reset buffer position to 0 from previous use
addUnsignedCharToBuffer(getDefinitionByte());
addUnsignedCharToBuffer(getDefinitionByte() xor UCHAR_MAX);
addShortIntToBuffer(0); // dummy for the length
Expand Down

0 comments on commit c98954d

Please sign in to comment.