Remove request_node_list fn

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/1/head
trivernis 4 years ago
parent 64203e5cac
commit 401bd11821
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.7.1" version = "0.8.0"
authors = ["trivernis <trivernis@protonmail.com>"] authors = ["trivernis <trivernis@protonmail.com>"]
edition = "2018" edition = "2018"
readme = "README.md" readme = "README.md"

@ -12,8 +12,8 @@ use crate::result::{VentedError, VentedResult};
use crate::server::data::{AsyncValue, Node, ServerConnectionContext}; use crate::server::data::{AsyncValue, Node, ServerConnectionContext};
use crate::server::server_events::{ use crate::server::server_events::{
AuthPayload, ChallengePayload, NodeInformationPayload, RedirectPayload, VersionMismatchPayload, AuthPayload, ChallengePayload, NodeInformationPayload, RedirectPayload, VersionMismatchPayload,
ACCEPT_EVENT, AUTH_EVENT, CHALLENGE_EVENT, CONNECT_EVENT, MISMATCH_EVENT, ACCEPT_EVENT, AUTH_EVENT, CHALLENGE_EVENT, CONNECT_EVENT, MISMATCH_EVENT, READY_EVENT,
NODE_LIST_REQUEST_EVENT, READY_EVENT, REDIRECT_EVENT, REJECT_EVENT, REDIRECT_EVENT, REJECT_EVENT,
}; };
use crossbeam_utils::sync::WaitGroup; use crossbeam_utils::sync::WaitGroup;
use parking_lot::Mutex; use parking_lot::Mutex;
@ -181,22 +181,6 @@ impl VentedServer {
wg2 wg2
} }
/// Request a list of network nodes from a trusted node
pub fn request_node_list(&self) -> VentedResult<()> {
let trusted_nodes = self
.known_nodes
.lock()
.values()
.filter(|node| node.trusted)
.cloned()
.collect::<Vec<Node>>();
for node in trusted_nodes {
self.emit(node.id, Event::new(NODE_LIST_REQUEST_EVENT))?;
}
Ok(())
}
/// Returns a copy of the servers metadata /// Returns a copy of the servers metadata
fn get_server_context(&self) -> ServerConnectionContext { fn get_server_context(&self) -> ServerConnectionContext {
ServerConnectionContext { ServerConnectionContext {

@ -16,7 +16,7 @@ pub(crate) const REDIRECT_EVENT: &str = "conn:redirect";
pub(crate) const REDIRECT_CONFIRM_EVENT: &str = "conn:redirect_confirm"; pub(crate) const REDIRECT_CONFIRM_EVENT: &str = "conn:redirect_confirm";
pub(crate) const REDIRECT_FAIL_EVENT: &str = "conn:redirect_failed"; pub(crate) const REDIRECT_FAIL_EVENT: &str = "conn:redirect_failed";
pub(crate) const REDIRECT_REDIRECTED_EVENT: &str = "conn:redirect_redirected"; pub(crate) const REDIRECT_REDIRECTED_EVENT: &str = "conn:redirect_redirected";
pub(crate) const NODE_LIST_REQUEST_EVENT: &str = "conn:node_list_request"; pub const NODE_LIST_REQUEST_EVENT: &str = "conn:node_list_request";
pub const NODE_LIST_EVENT: &str = "conn:node_list"; pub const NODE_LIST_EVENT: &str = "conn:node_list";
pub const READY_EVENT: &str = "server:ready"; pub const READY_EVENT: &str = "server:ready";

@ -5,7 +5,7 @@ use std::thread;
use std::time::Duration; use std::time::Duration;
use vented::event::Event; use vented::event::Event;
use vented::server::data::Node; use vented::server::data::Node;
use vented::server::server_events::READY_EVENT; use vented::server::server_events::{NODE_LIST_REQUEST_EVENT, READY_EVENT};
use vented::server::VentedServer; use vented::server::VentedServer;
fn setup() { fn setup() {
@ -97,7 +97,9 @@ fn test_server_communication() {
None None
} }
}); });
server_b.request_node_list().unwrap(); server_b
.emit("A".to_string(), Event::new(NODE_LIST_REQUEST_EVENT))
.unwrap();
server_c server_c
.emit("A".to_string(), Event::new("ping".to_string())) .emit("A".to_string(), Event::new("ping".to_string()))
.unwrap(); .unwrap();

Loading…
Cancel
Save