mirror of
https://github.com/uqbar-dao/nectar.git
synced 2025-01-02 05:28:22 +03:00
clippy cleanup, mark chess as nonfunctional at the moment
This commit is contained in:
parent
19910ce8e4
commit
b8a9445e44
@ -196,7 +196,7 @@
|
||||
|
||||
<h4>Apps:</h4>
|
||||
<!-- <a id="file-transfer" href="/file-transfer">File Transfer</a> -->
|
||||
<a id="chess" href="/chess:chess:uqbar/">Chess</a>
|
||||
<a id="chess" href="/chess:chess:uqbar/">Chess [NOT WORKING]</a>
|
||||
<a id="http-proxy" href="/http_proxy:http_proxy:uqbar/">HTTP Proxy</a>
|
||||
</div>
|
||||
<script>window.ourName = window.our = '${our}'</script>
|
||||
|
@ -152,7 +152,7 @@ async fn handle_message(
|
||||
ipc: serde_json::to_vec::<Result<HttpResponse, HttpClientError>>(
|
||||
&Ok(HttpResponse {
|
||||
status: response.status().as_u16(),
|
||||
headers: serialize_headers(&response.headers()),
|
||||
headers: serialize_headers(response.headers()),
|
||||
}),
|
||||
)
|
||||
.unwrap(),
|
||||
|
@ -101,7 +101,7 @@ pub async fn http_server(
|
||||
)
|
||||
.await;
|
||||
}
|
||||
return Err(anyhow::anyhow!("http_server: http_server loop exited"));
|
||||
Err(anyhow::anyhow!("http_server: http_server loop exited"))
|
||||
}
|
||||
|
||||
/// The 'server' part. Listens on a port assigned by runtime, and handles
|
||||
@ -775,12 +775,11 @@ async fn handle_app_message(
|
||||
)
|
||||
.await;
|
||||
return;
|
||||
}
|
||||
if message_type == WsMessageType::Ping {
|
||||
warp::ws::Message::ping(payload.bytes)
|
||||
} else {
|
||||
if message_type == WsMessageType::Ping {
|
||||
warp::ws::Message::ping(payload.bytes)
|
||||
} else {
|
||||
warp::ws::Message::pong(payload.bytes)
|
||||
}
|
||||
warp::ws::Message::pong(payload.bytes)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -111,6 +111,6 @@ pub async fn is_port_available(bind_addr: &str) -> bool {
|
||||
TcpListener::bind(bind_addr).await.is_ok()
|
||||
}
|
||||
|
||||
pub fn binary_encoded_string_to_bytes(s: &str) -> Vec<u8> {
|
||||
pub fn _binary_encoded_string_to_bytes(s: &str) -> Vec<u8> {
|
||||
s.chars().map(|c| c as u8).collect()
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ pub async fn timer_service(
|
||||
if !timer_map.contains(pop_time) {
|
||||
timer_tasks.spawn(async move {
|
||||
tokio::time::sleep(std::time::Duration::from_millis(timer_millis - 1)).await;
|
||||
return pop_time
|
||||
pop_time
|
||||
});
|
||||
}
|
||||
timer_map.insert(pop_time, km.id, km.rsvp.unwrap_or(km.source));
|
||||
@ -98,7 +98,7 @@ impl TimerMap {
|
||||
fn insert(&mut self, pop_time: u64, id: u64, addr: Address) {
|
||||
self.timers
|
||||
.entry(pop_time)
|
||||
.or_insert(vec![])
|
||||
.or_default()
|
||||
.push((id, addr));
|
||||
}
|
||||
|
||||
|
27
src/types.rs
27
src/types.rs
@ -31,7 +31,7 @@ pub type NodeId = String; // QNS domain name
|
||||
/// the process name can be a random number, or a name chosen by the user.
|
||||
/// the formatting is as follows:
|
||||
/// `[process name]:[package name]:[node ID]`
|
||||
#[derive(Clone, Debug, Eq, Hash, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)]
|
||||
pub struct ProcessId {
|
||||
process_name: String,
|
||||
package_name: String,
|
||||
@ -47,13 +47,13 @@ pub struct PackageId {
|
||||
}
|
||||
|
||||
impl PackageId {
|
||||
pub fn new(package_name: &str, publisher_node: &str) -> Self {
|
||||
pub fn _new(package_name: &str, publisher_node: &str) -> Self {
|
||||
PackageId {
|
||||
package_name: package_name.into(),
|
||||
publisher_node: publisher_node.into(),
|
||||
}
|
||||
}
|
||||
pub fn from_str(input: &str) -> Result<Self, ProcessIdParseError> {
|
||||
pub fn _from_str(input: &str) -> Result<Self, ProcessIdParseError> {
|
||||
// split string on colons into 2 segments
|
||||
let mut segments = input.split(':');
|
||||
let package_name = segments
|
||||
@ -72,10 +72,10 @@ impl PackageId {
|
||||
publisher_node,
|
||||
})
|
||||
}
|
||||
pub fn package(&self) -> &str {
|
||||
pub fn _package(&self) -> &str {
|
||||
&self.package_name
|
||||
}
|
||||
pub fn publisher(&self) -> &str {
|
||||
pub fn _publisher(&self) -> &str {
|
||||
&self.publisher_node
|
||||
}
|
||||
}
|
||||
@ -164,13 +164,13 @@ impl std::fmt::Display for ProcessId {
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq for ProcessId {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.process_name == other.process_name
|
||||
&& self.package_name == other.package_name
|
||||
&& self.publisher_node == other.publisher_node
|
||||
}
|
||||
}
|
||||
// impl PartialEq for ProcessId {
|
||||
// fn eq(&self, other: &Self) -> bool {
|
||||
// self.process_name == other.process_name
|
||||
// && self.package_name == other.package_name
|
||||
// && self.publisher_node == other.publisher_node
|
||||
// }
|
||||
// }
|
||||
|
||||
impl PartialEq<&str> for ProcessId {
|
||||
fn eq(&self, other: &&str) -> bool {
|
||||
@ -228,7 +228,7 @@ impl Address {
|
||||
process: process.into(),
|
||||
}
|
||||
}
|
||||
pub fn from_str(input: &str) -> Result<Self, AddressParseError> {
|
||||
pub fn _from_str(input: &str) -> Result<Self, AddressParseError> {
|
||||
// split string on colons into 4 segments,
|
||||
// first one with @, next 3 with :
|
||||
let mut name_rest = input.split('@');
|
||||
@ -304,6 +304,7 @@ impl std::fmt::Display for Address {
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[allow(dead_code)]
|
||||
pub enum AddressParseError {
|
||||
TooManyColons,
|
||||
MissingNodeId,
|
||||
|
Loading…
Reference in New Issue
Block a user