intel / gazebo-sitl

A ROS-independent Gazebo plugin for Ardupilot's SITL
Apache License 2.0
10 stars 14 forks source link

Handle sendto() return value #17

Closed guiccbr closed 8 years ago

guiccbr commented 8 years ago

In order to avoid coverity check problems.

Signed-off-by: Guilherme Campos Camargo guilherme.campos.camargo@intel.com

guiccbr commented 8 years ago

Just subtracting would not work properly because of the way we're filling up the buffer in queue_send_data(). For it to work right we would need to implement some sort of circular fifo, handling possible buffer overflows, etc.

Another option would be to lock inside handle_send() until all data has been sent. But if for any reason handle_send() is not successful and stays locked for too long, the plugin might crash gazebo because the update loop could possibly never end.

Since it is an UDP socket and the buffer is small, I think its a better strategy just to keep it simple and try to send the message again on the next call. But I'm not sure if that's the best approach.

rchiossi commented 8 years ago

Indeed. LGTM then.