fn reopen(&mut self, retry: bool) -> io::Result<()> {
        self.file.take();
        loop {
            let res = fs::OpenOptions::new()
                .append(true)
                .truncate(false)
                .create(true)
                .open(&self.name);
            match res {
                Ok(file) => {
                    let meta = file.metadata().unwrap();
                    self.dev = meta.dev();
                    self.ino = meta.ino();
                    self.file = Some(file);
                    break;
                },
                Err(e) => {
                    if !retry {
                        return Err(e);
                    }
                    thread::sleep(StdDuration::from_millis(1000));
                },
            }
        }
        Ok(())
    }
// re-open the datalog file.
re-open the datalog file.
re - open the datalog file .
fn reopen(&mut self, retry: bool) -> io::Result<()> {
        self.file.take();
        loop {
            let res = fs::OpenOptions::new()
                .append(true)
                .truncate(false)
                .create(true)
                .open(&self.name);
            match res {
                Ok(file) => {
                    let meta = file.metadata().unwrap();
                    self.dev = meta.dev();
                    self.ino = meta.ino();
                    self.file = Some(file);
                    break;
                },
                Err(e) => {
                    if !retry {
                        return Err(e);
                    }
                    thread::sleep(StdDuration::from_millis(1000));
                },
            }
        }
        Ok(())
    }
fn reopen ( & mut self , retry : bool ) -> io :: Result < ( ) > { self . file . take ( ) ; loop { let res = fs :: OpenOptions :: new ( ) . append ( true ) . truncate ( false ) . create ( true ) . open ( & self . name ) ; match res { Ok ( file ) => { let meta = file . metadata ( ) . unwrap ( ) ; self . dev = meta . dev ( ) ; self . ino = meta . ino ( ) ; self . file = Some ( file ) ; break ; } , Err ( e ) => { if ! retry { return Err ( e ) ; } thread :: sleep ( StdDuration :: from_millis ( 1000 ) ) ; } , } } Ok ( ( ) ) }
re-open the datalog file.
re - open the datalog file .
&mut self
retry
bool