update dependencies

This commit is contained in:
Scott Lamb 2017-11-16 23:01:09 -08:00
parent 16ed7f73ba
commit 5c8970fe8a
5 changed files with 382 additions and 320 deletions

648
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -26,19 +26,19 @@ lazy_static = "0.2"
libc = "0.2" libc = "0.2"
log = { version = "0.3", features = ["release_max_level_info"] } log = { version = "0.3", features = ["release_max_level_info"] }
lru-cache = "0.1" lru-cache = "0.1"
memmap = "0.5" memmap = "0.6"
mime = "0.3" mime = "0.3"
moonfire-ffmpeg = { path = "ffmpeg" } moonfire-ffmpeg = { path = "ffmpeg" }
mylog = { git = "https://github.com/scottlamb/mylog" } mylog = { git = "https://github.com/scottlamb/mylog" }
openssl = "0.9" openssl = "0.9"
parking_lot = { version = "0.4", features = [] } parking_lot = { version = "0.5", features = [] }
reffers = { git = "https://github.com/diwic/reffers-rs" } reffers = { git = "https://github.com/diwic/reffers-rs" }
regex = "0.2" regex = "0.2"
rusqlite = "0.12" rusqlite = "0.13"
serde = "1.0" serde = "1.0"
serde_derive = "1.0" serde_derive = "1.0"
serde_json = "1.0" serde_json = "1.0"
smallvec = "0.4" smallvec = "0.5"
time = "0.1" time = "0.1"
tokio-core = "0.1" tokio-core = "0.1"
tokio-signal = "0.1" tokio-signal = "0.1"
@ -46,11 +46,11 @@ url = "1.4"
uuid = { version = "0.5", features = ["serde", "v4"] } uuid = { version = "0.5", features = ["serde", "v4"] }
[dev-dependencies] [dev-dependencies]
reqwest = "0.7" reqwest = "0.8"
tempdir = "0.3" tempdir = "0.3"
[dependencies.cursive] [dependencies.cursive]
version = "0.5" version = "0.7"
#default-features = false #default-features = false
#features = ["termion-backend"] #features = ["termion-backend"]
@ -63,12 +63,4 @@ debug = true
[replace] [replace]
# This hyper fork has a patch to disable Nagle's algorithm. # This hyper fork has a patch to disable Nagle's algorithm.
"hyper:0.11.2" = { git = "https://github.com/scottlamb/hyper", branch = "moonfire-on-0.11.x" } "hyper:0.11.7" = { git = "https://github.com/scottlamb/hyper", branch = "moonfire-on-0.11.x" }
# The libc crate just added OS X support for clock_gettime, which Moonfire NVR
# needs. There hasn't been a release, so go straight to git for the moment.
# Do it for all platforms because [target.foo.replace] is apparently
# unsupported.
#[target.'cfg(target_os = "macos")'.replace]
#[target.x86_64-apple-darwin.replace]
"libc:0.2.31" = { git = "https://github.com/rust-lang/libc" }

View File

@ -85,13 +85,15 @@ fn open_conn(db_dir: &str, mode: OpenMode) -> Result<(dir::Fd, rusqlite::Connect
let conn = rusqlite::Connection::open_with_flags( let conn = rusqlite::Connection::open_with_flags(
Path::new(&db_dir).join("db"), Path::new(&db_dir).join("db"),
match mode { match mode {
OpenMode::ReadOnly => rusqlite::SQLITE_OPEN_READ_ONLY, OpenMode::ReadOnly => rusqlite::OpenFlags::SQLITE_OPEN_READ_ONLY,
OpenMode::ReadWrite => rusqlite::SQLITE_OPEN_READ_WRITE, OpenMode::ReadWrite => rusqlite::OpenFlags::SQLITE_OPEN_READ_WRITE,
OpenMode::Create => rusqlite::SQLITE_OPEN_READ_WRITE | rusqlite::SQLITE_OPEN_CREATE, 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 // rusqlite::Connection is not Sync, so there's no reason to tell SQLite3 to use the
// serialized threading mode. // serialized threading mode.
rusqlite::SQLITE_OPEN_NO_MUTEX)?; rusqlite::OpenFlags::SQLITE_OPEN_NO_MUTEX)?;
Ok((dir, conn)) Ok((dir, conn))
} }

View File

@ -1457,9 +1457,14 @@ impl FileInner {
}; };
let f = self.dir.open_sample_file(uuid)?; let f = self.dir.open_sample_file(uuid)?;
let start = s.s.sample_file_range().start + r.start; let start = s.s.sample_file_range().start + r.start;
let mmap = Box::new(memmap::Mmap::open_with_offset( let mmap = Box::new(unsafe {
&f, memmap::Protection::Read, start as usize, (r.end - r.start) as usize)?); memmap::MmapOptions::new()
Ok(ARefs::new(mmap).map(|m| unsafe { m.as_slice() })) .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> { 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 p = server.generated_len;
let mut buf = Vec::with_capacity(p as usize); let mut buf = Vec::with_capacity(p as usize);
b.bytes = p; b.bytes = p;
let client = reqwest::Client::new().unwrap(); let client = reqwest::Client::new();
let mut run = || { let mut run = || {
use self::reqwest::header::{Range, ByteRangeSpec}; use self::reqwest::header::{Range, ByteRangeSpec};
let mut resp = let mut resp =
client.get(server.url.clone()) client.get(server.url.clone())
.unwrap()
.header(Range::Bytes(vec![ByteRangeSpec::FromTo(0, p - 1)])) .header(Range::Bytes(vec![ByteRangeSpec::FromTo(0, p - 1)]))
.send() .send()
.unwrap(); .unwrap();

View File

@ -527,7 +527,7 @@ mod bench {
::std::thread::spawn(move || { ::std::thread::spawn(move || {
let addr = "127.0.0.1:0".parse().unwrap(); let addr = "127.0.0.1:0".parse().unwrap();
let (db, dir) = (db.db.clone(), db.dir.clone()); 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() let server = hyper::server::Http::new()
.bind(&addr, move || Ok(service.clone())) .bind(&addr, move || Ok(service.clone()))
.unwrap(); .unwrap();
@ -547,12 +547,12 @@ mod bench {
fn serve_camera_recordings(b: &mut Bencher) { fn serve_camera_recordings(b: &mut Bencher) {
testutil::init(); testutil::init();
let server = &*SERVER; 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(); *testutil::TEST_CAMERA_UUID)).unwrap();
let mut buf = Vec::new(); let mut buf = Vec::new();
let client = reqwest::Client::new().unwrap(); let client = reqwest::Client::new();
let mut f = || { 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); assert_eq!(resp.status(), reqwest::StatusCode::Ok);
buf.clear(); buf.clear();
use std::io::Read; use std::io::Read;