removing dev branch, many changes

This commit is contained in:
John Smith
2023-05-29 19:24:57 +00:00
parent 1430f3f656
commit 0a890c8707
250 changed files with 18084 additions and 8040 deletions

View File

@@ -38,7 +38,7 @@ fn map_to_internal_error<T: ToString>(e: T) -> VeilidAPIError {
fn decode_api_result<T: DeserializeOwned + fmt::Debug>(
reader: &api_result::Reader,
) -> Result<T, VeilidAPIError> {
) -> VeilidAPIResult<T> {
match reader.which().map_err(map_to_internal_error)? {
api_result::Which::Ok(v) => {
let ok_val = v.map_err(map_to_internal_error)?;
@@ -92,7 +92,7 @@ impl veilid_client::Server for VeilidClientImpl {
VeilidUpdate::Config(config) => {
self.comproc.update_config(config);
}
VeilidUpdate::Route(route) => {
VeilidUpdate::RouteChange(route) => {
self.comproc.update_route(route);
}
VeilidUpdate::Shutdown => self.comproc.update_shutdown(),
@@ -355,7 +355,7 @@ impl ClientApiConnection {
.map_err(map_to_string)?
.get_result()
.map_err(map_to_string)?;
let res: Result<(), VeilidAPIError> = decode_api_result(&reader);
let res: VeilidAPIResult<()> = decode_api_result(&reader);
res.map_err(map_to_string)
}
@@ -379,7 +379,7 @@ impl ClientApiConnection {
.map_err(map_to_string)?
.get_result()
.map_err(map_to_string)?;
let res: Result<(), VeilidAPIError> = decode_api_result(&reader);
let res: VeilidAPIResult<()> = decode_api_result(&reader);
res.map_err(map_to_string)
}
@@ -422,7 +422,7 @@ impl ClientApiConnection {
.map_err(map_to_string)?
.get_result()
.map_err(map_to_string)?;
let res: Result<String, VeilidAPIError> = decode_api_result(&reader);
let res: VeilidAPIResult<String> = decode_api_result(&reader);
res.map_err(map_to_string)
}
@@ -453,7 +453,7 @@ impl ClientApiConnection {
.map_err(map_to_string)?
.get_result()
.map_err(map_to_string)?;
let res: Result<(), VeilidAPIError> = decode_api_result(&reader);
let res: VeilidAPIResult<()> = decode_api_result(&reader);
res.map_err(map_to_string)
}
@@ -483,7 +483,7 @@ impl ClientApiConnection {
.map_err(map_to_string)?
.get_result()
.map_err(map_to_string)?;
let res: Result<(), VeilidAPIError> = decode_api_result(&reader);
let res: VeilidAPIResult<()> = decode_api_result(&reader);
res.map_err(map_to_string)
}

View File

@@ -406,7 +406,7 @@ reply - reply to an AppCall not handled directly by the server
pub fn update_config(&mut self, config: veilid_core::VeilidStateConfig) {
self.inner_mut().ui.set_config(config.config)
}
pub fn update_route(&mut self, route: veilid_core::VeilidStateRoute) {
pub fn update_route(&mut self, route: veilid_core::VeilidRouteChange) {
let mut out = String::new();
if !route.dead_routes.is_empty() {
out.push_str(&format!("Dead routes: {:?}", route.dead_routes));
@@ -445,46 +445,46 @@ reply - reply to an AppCall not handled directly by the server
pub fn update_app_message(&mut self, msg: veilid_core::VeilidAppMessage) {
// check is message body is ascii printable
let mut printable = true;
for c in &msg.message {
for c in msg.message() {
if *c < 32 || *c > 126 {
printable = false;
}
}
let strmsg = if printable {
String::from_utf8_lossy(&msg.message).to_string()
String::from_utf8_lossy(msg.message()).to_string()
} else {
hex::encode(&msg.message)
hex::encode(msg.message())
};
self.inner()
.ui
.add_node_event(format!("AppMessage ({:?}): {}", msg.sender, strmsg));
.add_node_event(format!("AppMessage ({:?}): {}", msg.sender(), strmsg));
}
pub fn update_app_call(&mut self, call: veilid_core::VeilidAppCall) {
// check is message body is ascii printable
let mut printable = true;
for c in &call.message {
for c in call.message() {
if *c < 32 || *c > 126 {
printable = false;
}
}
let strmsg = if printable {
String::from_utf8_lossy(&call.message).to_string()
String::from_utf8_lossy(call.message()).to_string()
} else {
format!("#{}", hex::encode(&call.message))
format!("#{}", hex::encode(call.message()))
};
self.inner().ui.add_node_event(format!(
"AppCall ({:?}) id = {:016x} : {}",
call.sender,
call.id.as_u64(),
call.sender(),
call.id().as_u64(),
strmsg
));
self.inner_mut().last_call_id = Some(call.id);
self.inner_mut().last_call_id = Some(call.id());
}
pub fn update_shutdown(&mut self) {

View File

@@ -53,13 +53,9 @@ impl TableViewItem<PeerTableColumn> for PeerTableData {
PeerTableColumn::NodeId => self
.node_ids
.first()
.cloned()
.map(|n| n.to_string())
.unwrap_or_else(|| "???".to_owned()),
PeerTableColumn::Address => format!(
"{:?}:{}",
self.peer_address.protocol_type(),
self.peer_address.to_socket_addr()
),
PeerTableColumn::Address => self.peer_address.clone(),
PeerTableColumn::LatencyAvg => format!(
"{}",
self.peer_stats