This PR fixes a bug in the sendCommand function, socket read returns a sstize_t which was being converted to an unsigned (size_t).
If a read error occurs it will return -1 which is converted to SIZE_MAX (18446744073709551615 on our machines) and then added to the total_read_len which wraps around to same value it had already (so the loop termination condition is never reached) and also fools the error if statement because it's greater than 0.
We occasionally have a lot of network traffic our robot which can lead to a few read errors when this happens the urg_node sometimes gets stuck in this loop because of the bug. With this fix the read error is handled properly and the node doesn't get stuck.
This PR fixes a bug in the sendCommand function, socket read returns a sstize_t which was being converted to an unsigned (size_t).
If a read error occurs it will return -1 which is converted to SIZE_MAX (18446744073709551615 on our machines) and then added to the total_read_len which wraps around to same value it had already (so the loop termination condition is never reached) and also fools the error if statement because it's greater than 0.
We occasionally have a lot of network traffic our robot which can lead to a few read errors when this happens the urg_node sometimes gets stuck in this loop because of the bug. With this fix the read error is handled properly and the node doesn't get stuck.