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]
name = "vented"
description = "Event driven encrypted tcp communicaton"
version = "0.7.1"
version = "0.8.0"
authors = ["trivernis <trivernis@protonmail.com>"]
edition = "2018"
readme = "README.md"

@ -12,8 +12,8 @@ use crate::result::{VentedError, VentedResult};
use crate::server::data::{AsyncValue, Node, ServerConnectionContext};
use crate::server::server_events::{
AuthPayload, ChallengePayload, NodeInformationPayload, RedirectPayload, VersionMismatchPayload,
ACCEPT_EVENT, AUTH_EVENT, CHALLENGE_EVENT, CONNECT_EVENT, MISMATCH_EVENT,
NODE_LIST_REQUEST_EVENT, READY_EVENT, REDIRECT_EVENT, REJECT_EVENT,
ACCEPT_EVENT, AUTH_EVENT, CHALLENGE_EVENT, CONNECT_EVENT, MISMATCH_EVENT, READY_EVENT,
REDIRECT_EVENT, REJECT_EVENT,
};
use crossbeam_utils::sync::WaitGroup;
use parking_lot::Mutex;
@ -181,22 +181,6 @@ impl VentedServer {
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
fn get_server_context(&self) -> 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_FAIL_EVENT: &str = "conn:redirect_failed";
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 READY_EVENT: &str = "server:ready";

@ -5,7 +5,7 @@ use std::thread;
use std::time::Duration;
use vented::event::Event;
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;
fn setup() {
@ -97,7 +97,9 @@ fn test_server_communication() {
None
}
});
server_b.request_node_list().unwrap();
server_b
.emit("A".to_string(), Event::new(NODE_LIST_REQUEST_EVENT))
.unwrap();
server_c
.emit("A".to_string(), Event::new("ping".to_string()))
.unwrap();

Loading…
Cancel
Save