Fix memory leak for real

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/1/head
trivernis 4 years ago
parent ac81f69209
commit 9da5931435
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.4.1" version = "0.4.2"
authors = ["trivernis <trivernis@protonmail.com>"] authors = ["trivernis <trivernis@protonmail.com>"]
edition = "2018" edition = "2018"
readme = "README.md" readme = "README.md"

@ -305,7 +305,13 @@ impl VentedServer {
self.redirect_handles self.redirect_handles
.lock() .lock()
.insert(payload.id, Future::clone(&future)); .insert(payload.id, Future::clone(&future));
self.emit(node.id, Event::with_payload(REDIRECT_EVENT, &payload))?;
if let Ok(stream) = self.get_connection(&node.id) {
if let Err(e) = stream.send(Event::with_payload(REDIRECT_EVENT, &payload)) {
log::error!("Failed to send event: {}", e);
self.connections.lock().remove(stream.receiver_node());
}
}
if let Some(value) = future.get_value_with_timeout(1000) { if let Some(value) = future.get_value_with_timeout(1000) {
if value { if value {

Loading…
Cancel
Save