upgrade some server deps

I avoided rtcp 0.2.2->0.2.3 because of an accidental semver break.
This commit is contained in:
Scott Lamb
2021-07-09 15:01:15 -07:00
parent 75e3b85850
commit 1df55efc43
7 changed files with 249 additions and 167 deletions

View File

@@ -28,7 +28,7 @@ libc = "0.2"
libpasta = "0.1.2"
log = "0.4"
mylog = { git = "https://github.com/scottlamb/mylog" }
nix = "0.20.0"
nix = "0.22.0"
odds = { version = "0.4.0", features = ["std-vec"] }
parking_lot = { version = "0.11.1", features = [] }
pretty-hex = "0.2.1"

View File

@@ -105,7 +105,7 @@ impl Fd {
pub fn open<P: ?Sized + NixPath>(path: &P, mkdir: bool) -> Result<Fd, nix::Error> {
if mkdir {
match nix::unistd::mkdir(path, nix::sys::stat::Mode::S_IRWXU) {
Ok(()) | Err(nix::Error::Sys(nix::errno::Errno::EEXIST)) => {}
Ok(()) | Err(nix::Error::EEXIST) => {}
Err(e) => return Err(e),
}
}
@@ -134,7 +134,7 @@ pub(crate) fn read_meta(dir: &Fd) -> Result<schema::DirMeta, Error> {
let mut meta = schema::DirMeta::default();
let mut f = match crate::fs::openat(dir.0, cstr!("meta"), OFlag::O_RDONLY, Mode::empty()) {
Err(e) => {
if e == nix::Error::Sys(nix::errno::Errno::ENOENT) {
if e == nix::Error::ENOENT {
return Ok(meta);
}
return Err(e.into());

View File

@@ -74,7 +74,7 @@ pub fn run(_args: &super::Args, tx: &rusqlite::Transaction) -> Result<(), Error>
Some(d.fd.as_raw_fd()),
&to_path,
) {
if e == nix::Error::Sys(nix::errno::Errno::ENOENT) {
if e == nix::Error::ENOENT {
continue; // assume it was already moved.
}
return Err(e.into());

View File

@@ -331,7 +331,7 @@ impl<C: Clocks + Clone> Syncer<C, Arc<dir::SampleFileDir>> {
let mut undeletable = 0;
for &id in &to_abandon {
if let Err(e) = dir.unlink_file(id) {
if e == nix::Error::Sys(nix::errno::Errno::ENOENT) {
if e == nix::Error::ENOENT {
warn!("dir: abandoned recording {} already deleted!", id);
} else {
warn!("dir: Unable to unlink abandoned recording {}: {}", id, e);
@@ -386,7 +386,7 @@ impl<C: Clocks + Clone> Syncer<C, Arc<dir::SampleFileDir>> {
let mut errors = 0;
for &id in &garbage {
if let Err(e) = self.dir.unlink_file(id) {
if e != nix::Error::Sys(nix::errno::Errno::ENOENT) {
if e != nix::Error::ENOENT {
warn!("dir: Unable to unlink {}: {}", id, e);
errors += 1;
}
@@ -467,7 +467,7 @@ impl<C: Clocks + Clone, D: DirWriter> Syncer<C, D> {
for &id in &garbage {
clock::retry_forever(c, &mut || {
if let Err(e) = self.dir.unlink_file(id) {
if e == nix::Error::Sys(nix::errno::Errno::ENOENT) {
if e == nix::Error::ENOENT {
warn!("dir: recording {} already deleted!", id);
return Ok(());
}
@@ -1107,9 +1107,6 @@ mod tests {
fn eio() -> io::Error {
io::Error::new(io::ErrorKind::Other, "got EIO")
}
fn nix_eio() -> nix::Error {
nix::Error::Sys(nix::errno::Errno::EIO)
}
#[test]
fn excessive_pts_jump() {
@@ -1135,7 +1132,7 @@ mod tests {
);
h.dir.expect(MockDirAction::Create(
CompositeId::new(1, 0),
Box::new(|_id| Err(nix_eio())),
Box::new(|_id| Err(nix::Error::EIO)),
));
let f = MockFile::new();
h.dir.expect(MockDirAction::Create(
@@ -1316,7 +1313,7 @@ mod tests {
);
h.dir.expect(MockDirAction::Create(
CompositeId::new(1, 0),
Box::new(|_id| Err(nix_eio())),
Box::new(|_id| Err(nix::Error::EIO)),
));
let f = MockFile::new();
h.dir.expect(MockDirAction::Create(
@@ -1346,7 +1343,7 @@ mod tests {
f.expect(MockFileAction::SyncAll(Box::new(|| Ok(()))));
w.write(b"1234", recording::Time(1), 0, true).unwrap();
h.dir
.expect(MockDirAction::Sync(Box::new(|| Err(nix_eio()))));
.expect(MockDirAction::Sync(Box::new(|| Err(nix::Error::EIO))));
h.dir.expect(MockDirAction::Sync(Box::new(|| Ok(()))));
drop(w);
assert!(h.syncer.iter(&h.syncer_rcv)); // AsyncSave
@@ -1462,7 +1459,7 @@ mod tests {
assert_eq!(s.bytes_to_delete, 0);
assert_eq!(s.bytes_to_add, 0);
assert_eq!(s.sample_file_bytes, 1);
Err(nix_eio()) // force a retry.
Err(nix::Error::EIO) // force a retry.
}
}),
));
@@ -1471,7 +1468,7 @@ mod tests {
Box::new(|_| Ok(())),
));
h.dir
.expect(MockDirAction::Sync(Box::new(|| Err(nix_eio()))));
.expect(MockDirAction::Sync(Box::new(|| Err(nix::Error::EIO))));
h.dir.expect(MockDirAction::Sync(Box::new(|| Ok(()))));
drop(w);