summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--talpid-core/src/proxy/shadowsocks.rs19
-rw-r--r--talpid-core/src/split_tunnel/linux.rs14
2 files changed, 11 insertions, 22 deletions
diff --git a/talpid-core/src/proxy/shadowsocks.rs b/talpid-core/src/proxy/shadowsocks.rs
index 7fbf4cb5f9..6436e967c5 100644
--- a/talpid-core/src/proxy/shadowsocks.rs
+++ b/talpid-core/src/proxy/shadowsocks.rs
@@ -186,17 +186,14 @@ impl ShadowsocksProxyMonitor {
error.display_chain_with_msg("Failed to initialize PidManager"),
)
})?;
- let i32_pids = subproc
- .pids()
- .iter()
- .map(|pid| *pid as i32)
- .collect::<Vec<_>>();
- excluded_pids.add_list(&i32_pids).map_err(|error| {
- Error::new(
- ErrorKind::Other,
- error.display_chain_with_msg("Failed to exclude Shadowsocks process"),
- )
- })?;
+ for pid in subproc.pids() {
+ excluded_pids.add(pid as i32).map_err(|error| {
+ Error::new(
+ ErrorKind::Other,
+ error.display_chain_with_msg("Failed to exclude Shadowsocks process"),
+ )
+ })?;
+ }
}
match Self::get_bound_port(File::open(&logfile)?, &subproc) {
diff --git a/talpid-core/src/split_tunnel/linux.rs b/talpid-core/src/split_tunnel/linux.rs
index 6944aada4d..83296439f5 100644
--- a/talpid-core/src/split_tunnel/linux.rs
+++ b/talpid-core/src/split_tunnel/linux.rs
@@ -103,11 +103,6 @@ impl PidManager {
/// Add a PID to exclude from the tunnel.
pub fn add(&self, pid: i32) -> Result<(), Error> {
- self.add_list(&[pid])
- }
-
- /// Add PIDs to exclude from the tunnel.
- pub fn add_list<T: Into<i32> + ToString>(&self, pids: &[T]) -> Result<(), Error> {
let exclusions_path = self
.net_cls_path
.join(SPLIT_TUNNEL_CGROUP_NAME)
@@ -121,12 +116,9 @@ impl PidManager {
let mut writer = BufWriter::new(file);
- for pid in pids {
- writer
- .write_all(pid.to_string().as_bytes())
- .map_err(Error::AddCGroupPid)?;
- }
-
+ writer
+ .write_all(pid.to_string().as_bytes())
+ .map_err(Error::AddCGroupPid)?;
Ok(())
}