AP_HAL_SITL: check to see if setting socket and fd options worked

This commit is contained in:
Peter Barker 2018-12-14 13:37:20 +11:00 committed by Peter Barker
parent 24653a33ed
commit e420f62b62
1 changed files with 15 additions and 3 deletions

View File

@ -122,9 +122,21 @@ void SITL_State::_setup_fdm(void)
fprintf(stderr, "Aborting launch...\n"); fprintf(stderr, "Aborting launch...\n");
exit(1); exit(1);
} }
_sitl_rc_in.reuseaddress(); if (!_sitl_rc_in.reuseaddress()) {
_sitl_rc_in.set_blocking(false); fprintf(stderr, "SITL: socket reuseaddress failed on RC in port: %d - %s\n", _rcin_port, strerror(errno));
_sitl_rc_in.set_cloexec(); fprintf(stderr, "Aborting launch...\n");
exit(1);
}
if (!_sitl_rc_in.set_blocking(false)) {
fprintf(stderr, "SITL: socket set_blocking(false) failed on RC in port: %d - %s\n", _rcin_port, strerror(errno));
fprintf(stderr, "Aborting launch...\n");
exit(1);
}
if (!_sitl_rc_in.set_cloexec()) {
fprintf(stderr, "SITL: socket set_cloexec() failed on RC in port: %d - %s\n", _rcin_port, strerror(errno));
fprintf(stderr, "Aborting launch...\n");
exit(1);
}
} }
#endif #endif