Skip to content

Commit

Permalink
Clear buffer before reading new message, to fix mixed messages
Browse files Browse the repository at this point in the history
  • Loading branch information
cpr-marcoh committed Mar 18, 2024
1 parent d4d852b commit 9fbb5d0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions irc_ros_hardware/src/CRI/cri_socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,13 @@ void CriSocket::ReceiveThreadFunction()
char buffer[bufferSize] = {0};

while (continueReceive) {


if (connectionNeeded) {
MakeConnection();
}

std::fill_n(buffer, bufferSize, '\0');
int valread = read(sock, buffer, bufferSize);

if (!IsSocketOk()) {
Expand Down

0 comments on commit 9fbb5d0

Please sign in to comment.