mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-12-04 23:02:32 -05:00
update dependencies
This commit is contained in:
@@ -85,13 +85,15 @@ fn open_conn(db_dir: &str, mode: OpenMode) -> Result<(dir::Fd, rusqlite::Connect
|
||||
let conn = rusqlite::Connection::open_with_flags(
|
||||
Path::new(&db_dir).join("db"),
|
||||
match mode {
|
||||
OpenMode::ReadOnly => rusqlite::SQLITE_OPEN_READ_ONLY,
|
||||
OpenMode::ReadWrite => rusqlite::SQLITE_OPEN_READ_WRITE,
|
||||
OpenMode::Create => rusqlite::SQLITE_OPEN_READ_WRITE | rusqlite::SQLITE_OPEN_CREATE,
|
||||
OpenMode::ReadOnly => rusqlite::OpenFlags::SQLITE_OPEN_READ_ONLY,
|
||||
OpenMode::ReadWrite => rusqlite::OpenFlags::SQLITE_OPEN_READ_WRITE,
|
||||
OpenMode::Create => {
|
||||
rusqlite::OpenFlags::SQLITE_OPEN_READ_WRITE | rusqlite::OpenFlags::SQLITE_OPEN_CREATE
|
||||
},
|
||||
} |
|
||||
// rusqlite::Connection is not Sync, so there's no reason to tell SQLite3 to use the
|
||||
// serialized threading mode.
|
||||
rusqlite::SQLITE_OPEN_NO_MUTEX)?;
|
||||
rusqlite::OpenFlags::SQLITE_OPEN_NO_MUTEX)?;
|
||||
Ok((dir, conn))
|
||||
}
|
||||
|
||||
|
||||
14
src/mp4.rs
14
src/mp4.rs
@@ -1457,9 +1457,14 @@ impl FileInner {
|
||||
};
|
||||
let f = self.dir.open_sample_file(uuid)?;
|
||||
let start = s.s.sample_file_range().start + r.start;
|
||||
let mmap = Box::new(memmap::Mmap::open_with_offset(
|
||||
&f, memmap::Protection::Read, start as usize, (r.end - r.start) as usize)?);
|
||||
Ok(ARefs::new(mmap).map(|m| unsafe { m.as_slice() }))
|
||||
let mmap = Box::new(unsafe {
|
||||
memmap::MmapOptions::new()
|
||||
.offset(start as usize)
|
||||
.len((r.end - r.start) as usize)
|
||||
.map(&f)?
|
||||
});
|
||||
use core::ops::Deref;
|
||||
Ok(ARefs::new(mmap).map(|m| m.deref()))
|
||||
}
|
||||
|
||||
fn get_subtitle_sample_data(&self, i: usize, r: Range<u64>, l: u64) -> Result<Chunk, Error> {
|
||||
@@ -2278,12 +2283,11 @@ mod bench {
|
||||
let p = server.generated_len;
|
||||
let mut buf = Vec::with_capacity(p as usize);
|
||||
b.bytes = p;
|
||||
let client = reqwest::Client::new().unwrap();
|
||||
let client = reqwest::Client::new();
|
||||
let mut run = || {
|
||||
use self::reqwest::header::{Range, ByteRangeSpec};
|
||||
let mut resp =
|
||||
client.get(server.url.clone())
|
||||
.unwrap()
|
||||
.header(Range::Bytes(vec![ByteRangeSpec::FromTo(0, p - 1)]))
|
||||
.send()
|
||||
.unwrap();
|
||||
|
||||
@@ -527,7 +527,7 @@ mod bench {
|
||||
::std::thread::spawn(move || {
|
||||
let addr = "127.0.0.1:0".parse().unwrap();
|
||||
let (db, dir) = (db.db.clone(), db.dir.clone());
|
||||
let service = super::Service::new(db.clone(), dir.clone(), None);
|
||||
let service = super::Service::new(db.clone(), dir.clone(), None, "".to_owned()).unwrap();
|
||||
let server = hyper::server::Http::new()
|
||||
.bind(&addr, move || Ok(service.clone()))
|
||||
.unwrap();
|
||||
@@ -547,12 +547,12 @@ mod bench {
|
||||
fn serve_camera_recordings(b: &mut Bencher) {
|
||||
testutil::init();
|
||||
let server = &*SERVER;
|
||||
let url = reqwest::Url::parse(&format!("{}/cameras/{}/recordings", server.base_url,
|
||||
let url = reqwest::Url::parse(&format!("{}/api/cameras/{}/recordings", server.base_url,
|
||||
*testutil::TEST_CAMERA_UUID)).unwrap();
|
||||
let mut buf = Vec::new();
|
||||
let client = reqwest::Client::new().unwrap();
|
||||
let client = reqwest::Client::new();
|
||||
let mut f = || {
|
||||
let mut resp = client.get(url.clone()).unwrap().send().unwrap();
|
||||
let mut resp = client.get(url.clone()).send().unwrap();
|
||||
assert_eq!(resp.status(), reqwest::StatusCode::Ok);
|
||||
buf.clear();
|
||||
use std::io::Read;
|
||||
|
||||
Reference in New Issue
Block a user