AP_Logger: handle long delays in opening log files
This commit is contained in:
parent
88352b73bb
commit
215c41dbb1
@ -559,7 +559,9 @@ uint16_t AP_Logger_File::find_last_log()
|
||||
if (fname == nullptr) {
|
||||
return ret;
|
||||
}
|
||||
hal.scheduler->expect_delay_ms(3000);
|
||||
int fd = open(fname, O_RDONLY|O_CLOEXEC);
|
||||
hal.scheduler->expect_delay_ms(0);
|
||||
free(fname);
|
||||
if (fd != -1) {
|
||||
char buf[10];
|
||||
@ -693,7 +695,9 @@ int16_t AP_Logger_File::get_log_data(const uint16_t list_entry, const uint16_t p
|
||||
return -1;
|
||||
}
|
||||
stop_logging();
|
||||
hal.scheduler->expect_delay_ms(3000);
|
||||
_read_fd = ::open(fname, O_RDONLY|O_CLOEXEC);
|
||||
hal.scheduler->expect_delay_ms(0);
|
||||
if (_read_fd == -1) {
|
||||
_open_error = true;
|
||||
int saved_errno = errno;
|
||||
@ -869,12 +873,14 @@ uint16_t AP_Logger_File::start_new_log(void)
|
||||
write_fd_semaphore.give();
|
||||
return 0xFFFF;
|
||||
}
|
||||
hal.scheduler->expect_delay_ms(3000);
|
||||
#if HAL_OS_POSIX_IO
|
||||
_write_fd = ::open(_write_filename, O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666);
|
||||
#else
|
||||
//TODO add support for mode flags
|
||||
_write_fd = ::open(_write_filename, O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC);
|
||||
#endif
|
||||
hal.scheduler->expect_delay_ms(0);
|
||||
_cached_oldest_log = 0;
|
||||
|
||||
if (_write_fd == -1) {
|
||||
@ -898,11 +904,13 @@ uint16_t AP_Logger_File::start_new_log(void)
|
||||
|
||||
// we avoid fopen()/fprintf() here as it is not available on as many
|
||||
// systems as open/write
|
||||
hal.scheduler->expect_delay_ms(3000);
|
||||
#if HAL_OS_POSIX_IO
|
||||
int fd = open(fname, O_WRONLY|O_CREAT|O_CLOEXEC, 0644);
|
||||
#else
|
||||
int fd = open(fname, O_WRONLY|O_CREAT|O_CLOEXEC);
|
||||
#endif
|
||||
hal.scheduler->expect_delay_ms(0);
|
||||
free(fname);
|
||||
if (fd == -1) {
|
||||
_open_error = true;
|
||||
|
Loading…
Reference in New Issue
Block a user