Add check if node is known for redirect events

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/1/head
trivernis 4 years ago
parent 6a2f24945d
commit 9a556309e4
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -1,7 +1,7 @@
[package] [package]
name = "vented" name = "vented"
description = "Event driven encrypted tcp communicaton" description = "Event driven encrypted tcp communicaton"
version = "0.6.3" version = "0.6.4"
authors = ["trivernis <trivernis@protonmail.com>"] authors = ["trivernis <trivernis@protonmail.com>"]
edition = "2018" edition = "2018"
readme = "README.md" readme = "README.md"

@ -333,7 +333,7 @@ impl VentedServer {
} }
} }
log::debug!("All connection attempts to {} failed!", target); log::trace!("All direct connection attempts to {} failed", target);
Err(VentedError::UnreachableNode(target.clone())) Err(VentedError::UnreachableNode(target.clone()))
} }

@ -143,12 +143,14 @@ impl VentedServer {
let event_handler = Arc::clone(&self.event_handler); let event_handler = Arc::clone(&self.event_handler);
let connections = Arc::clone(&self.connections); let connections = Arc::clone(&self.connections);
let pool = Arc::clone(&self.sender_pool); let pool = Arc::clone(&self.sender_pool);
let known_nodes = Arc::clone(&self.known_nodes);
move |event| { move |event| {
let payload = event.get_payload::<RedirectPayload>().ok()?; let payload = event.get_payload::<RedirectPayload>().ok()?;
let event = Event::from_bytes(&mut &payload.content[..]).ok()?; let event = Event::from_bytes(&mut &payload.content[..]).ok()?;
let proxy_stream = connections.lock().get(&payload.proxy)?.clone(); let proxy_stream = connections.lock().get(&payload.proxy)?.clone();
if known_nodes.lock().contains_key(&payload.source) {
pool.lock().execute({ pool.lock().execute({
let event_handler = Arc::clone(&event_handler); let event_handler = Arc::clone(&event_handler);
move || { move || {
@ -171,6 +173,7 @@ impl VentedServer {
} }
} }
}); });
}
None None
} }

Loading…
Cancel
Save