Moving away from peer threads

This commit is contained in:
Mathias Hall-Andersen
2019-12-03 21:49:08 +01:00
parent 549b2cf5d0
commit 5a7f762d6c
14 changed files with 641 additions and 433 deletions

View File

@@ -359,31 +359,9 @@ impl PlatformTun for LinuxTun {
// create PlatformTunMTU instance
Ok((
vec![LinuxTunReader { fd }], // TODO: enable multi-queue for Linux
vec![LinuxTunReader { fd }], // TODO: use multi-queue for Linux
LinuxTunWriter { fd },
LinuxTunStatus::new(req.name)?,
))
}
}
#[cfg(test)]
mod tests {
use super::*;
use std::env;
fn is_root() -> bool {
match env::var("USER") {
Ok(val) => val == "root",
Err(_) => false,
}
}
#[test]
fn test_tun_create() {
if !is_root() {
return;
}
let (readers, writers, mtu) = LinuxTun::create("test").unwrap();
// TODO: test (any good idea how?)
}
}