mirror of
https://gitlab.com/veilid/veilid.git
synced 2024-11-26 02:30:48 -06:00
lints
This commit is contained in:
parent
45489d0e9c
commit
ea8c75a29f
2
external/if-addrs
vendored
2
external/if-addrs
vendored
@ -1 +1 @@
|
|||||||
Subproject commit bf082064c312f5eba998cca90a02c185998dce9d
|
Subproject commit d16e76ce1f6edb03300e3f9ee264fcd611799fdb
|
2
external/keyring-rs
vendored
2
external/keyring-rs
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 6562019f0b86f622ab5dcadede80f7c8c8ea1eea
|
Subproject commit 70616ea279ae560d0f91d23ad707c713320e3d7b
|
2
external/keyvaluedb
vendored
2
external/keyvaluedb
vendored
@ -1 +1 @@
|
|||||||
Subproject commit a0ade9c9c9eafb54f240106a36edc74f34c2ebfd
|
Subproject commit 4971ce612e7aace83b17022132687f6f380dbbae
|
@ -127,9 +127,9 @@ impl AttachmentManager {
|
|||||||
crypto: crypto.clone(),
|
crypto: crypto.clone(),
|
||||||
attachment_machine: CallbackStateMachine::new(),
|
attachment_machine: CallbackStateMachine::new(),
|
||||||
network_manager: NetworkManager::new(
|
network_manager: NetworkManager::new(
|
||||||
config.clone(),
|
config,
|
||||||
table_store.clone(),
|
table_store,
|
||||||
crypto.clone(),
|
crypto,
|
||||||
),
|
),
|
||||||
maintain_peers: false,
|
maintain_peers: false,
|
||||||
peer_count: 0,
|
peer_count: 0,
|
||||||
|
@ -111,7 +111,7 @@ impl ConnectionTable {
|
|||||||
|
|
||||||
let res = inner.conn_by_addr.remove(descriptor);
|
let res = inner.conn_by_addr.remove(descriptor);
|
||||||
match res {
|
match res {
|
||||||
Some(v) => Ok(v.clone()),
|
Some(v) => Ok(v),
|
||||||
None => Err(()),
|
None => Err(()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ pub async fn save_user_secret_string(
|
|||||||
let existed = kr.get_password().is_ok();
|
let existed = kr.get_password().is_ok();
|
||||||
let _ = kr
|
let _ = kr
|
||||||
.set_password(value)
|
.set_password(value)
|
||||||
.map_err(|e| format!("Failed to save user secret: {}", e).to_owned())?;
|
.map_err(|e| format!("Failed to save user secret: {}", e))?;
|
||||||
Ok(existed)
|
Ok(existed)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ pub async fn load_user_secret_string(namespace: &str, key: &str) -> Result<Optio
|
|||||||
match kr.get_password() {
|
match kr.get_password() {
|
||||||
Ok(v) => Ok(Some(v)),
|
Ok(v) => Ok(Some(v)),
|
||||||
Err(KeyringError::NoPasswordFound) => Ok(None),
|
Err(KeyringError::NoPasswordFound) => Ok(None),
|
||||||
Err(e) => Err(format!("Failed to load user secret: {}", e).to_owned()),
|
Err(e) => Err(format!("Failed to load user secret: {}", e)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,6 +53,6 @@ pub async fn remove_user_secret_string(namespace: &str, key: &str) -> Result<boo
|
|||||||
match kr.delete_password() {
|
match kr.delete_password() {
|
||||||
Ok(_) => Ok(true),
|
Ok(_) => Ok(true),
|
||||||
Err(KeyringError::NoPasswordFound) => Ok(false),
|
Err(KeyringError::NoPasswordFound) => Ok(false),
|
||||||
Err(e) => Err(format!("Failed to remove user secret: {}", e).to_owned()),
|
Err(e) => Err(format!("Failed to remove user secret: {}", e)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ impl TableDB {
|
|||||||
Self {
|
Self {
|
||||||
inner: Arc::new(Mutex::new(TableDBInner {
|
inner: Arc::new(Mutex::new(TableDBInner {
|
||||||
table,
|
table,
|
||||||
table_store: table_store.clone(),
|
table_store,
|
||||||
database,
|
database,
|
||||||
})),
|
})),
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ impl LeaseManager {
|
|||||||
self.inner.lock().client_relay_mode
|
self.inner.lock().client_relay_mode
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn client_is_relay_peer_addr(&self, peer_addr: PeerAddress) -> bool {
|
pub fn client_is_relay_peer_addr(&self, _peer_addr: PeerAddress) -> bool {
|
||||||
error!("unimplemented");
|
error!("unimplemented");
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
@ -101,7 +101,7 @@ impl LeaseManager {
|
|||||||
// Server-side
|
// Server-side
|
||||||
|
|
||||||
// Signal leases
|
// Signal leases
|
||||||
pub fn server_has_valid_signal_lease(&self, recipient_id: &DHTKey) -> bool {
|
pub fn server_has_valid_signal_lease(&self, _recipient_id: &DHTKey) -> bool {
|
||||||
error!("unimplemented");
|
error!("unimplemented");
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
@ -143,7 +143,7 @@ impl LeaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Relay leases
|
// Relay leases
|
||||||
pub fn server_has_valid_relay_lease(&self, recipient_id: &DHTKey) -> bool {
|
pub fn server_has_valid_relay_lease(&self, _recipient_id: &DHTKey) -> bool {
|
||||||
error!("unimplemented");
|
error!("unimplemented");
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ impl NetworkManager {
|
|||||||
|
|
||||||
pub fn new(config: VeilidConfig, table_store: TableStore, crypto: Crypto) -> Self {
|
pub fn new(config: VeilidConfig, table_store: TableStore, crypto: Crypto) -> Self {
|
||||||
Self {
|
Self {
|
||||||
config: config.clone(),
|
config,
|
||||||
table_store,
|
table_store,
|
||||||
crypto,
|
crypto,
|
||||||
inner: Arc::new(Mutex::new(Self::new_inner())),
|
inner: Arc::new(Mutex::new(Self::new_inner())),
|
||||||
@ -269,7 +269,7 @@ impl NetworkManager {
|
|||||||
.lock()
|
.lock()
|
||||||
.connection_add_channel_tx
|
.connection_add_channel_tx
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.ok_or("connection channel isn't open yet".to_owned())?
|
.ok_or_else(|| "connection channel isn't open yet".to_owned())?
|
||||||
.clone();
|
.clone();
|
||||||
let this = self.clone();
|
let this = self.clone();
|
||||||
let receiver_loop_future = Self::process_connection(this, descriptor, conn);
|
let receiver_loop_future = Self::process_connection(this, descriptor, conn);
|
||||||
|
@ -321,7 +321,7 @@ impl ReceiptManager {
|
|||||||
let mut inner = self.inner.lock();
|
let mut inner = self.inner.lock();
|
||||||
inner
|
inner
|
||||||
.receipts_by_nonce
|
.receipts_by_nonce
|
||||||
.insert(receipt.get_nonce(), record.clone());
|
.insert(receipt.get_nonce(), record);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn record_single_shot_receipt(
|
pub fn record_single_shot_receipt(
|
||||||
@ -336,7 +336,7 @@ impl ReceiptManager {
|
|||||||
let mut inner = self.inner.lock();
|
let mut inner = self.inner.lock();
|
||||||
inner
|
inner
|
||||||
.receipts_by_nonce
|
.receipts_by_nonce
|
||||||
.insert(receipt.get_nonce(), record.clone());
|
.insert(receipt.get_nonce(), record);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_next_oldest_timestamp(inner: &mut ReceiptManagerInner) {
|
fn update_next_oldest_timestamp(inner: &mut ReceiptManagerInner) {
|
||||||
|
@ -208,7 +208,7 @@ impl RoutingTable {
|
|||||||
"Local Dial Info: {} ({:?})",
|
"Local Dial Info: {} ({:?})",
|
||||||
NodeDialInfoSingle {
|
NodeDialInfoSingle {
|
||||||
node_id: NodeId::new(inner.node_id),
|
node_id: NodeId::new(inner.node_id),
|
||||||
dial_info: dial_info.clone()
|
dial_info
|
||||||
}
|
}
|
||||||
.to_string(),
|
.to_string(),
|
||||||
origin,
|
origin,
|
||||||
@ -284,7 +284,7 @@ impl RoutingTable {
|
|||||||
"Public Dial Info: {} ({:?}#{:?})",
|
"Public Dial Info: {} ({:?}#{:?})",
|
||||||
NodeDialInfoSingle {
|
NodeDialInfoSingle {
|
||||||
node_id: NodeId::new(inner.node_id),
|
node_id: NodeId::new(inner.node_id),
|
||||||
dial_info: dial_info.clone()
|
dial_info
|
||||||
}
|
}
|
||||||
.to_string(),
|
.to_string(),
|
||||||
origin,
|
origin,
|
||||||
|
@ -81,21 +81,21 @@ pub async fn test_add_get_remove() {
|
|||||||
assert_eq!(table.get_connection(&a1), Some(entry1.clone()));
|
assert_eq!(table.get_connection(&a1), Some(entry1.clone()));
|
||||||
assert_eq!(table.get_connection(&a1), Some(entry1.clone()));
|
assert_eq!(table.get_connection(&a1), Some(entry1.clone()));
|
||||||
assert_eq!(table.connection_count(), 1);
|
assert_eq!(table.connection_count(), 1);
|
||||||
assert_eq!(table.remove_connection(&a2), Ok(entry1.clone()));
|
assert_eq!(table.remove_connection(&a2), Ok(entry1));
|
||||||
assert_eq!(table.connection_count(), 0);
|
assert_eq!(table.connection_count(), 0);
|
||||||
assert_eq!(table.remove_connection(&a2), Err(()));
|
assert_eq!(table.remove_connection(&a2), Err(()));
|
||||||
assert_eq!(table.connection_count(), 0);
|
assert_eq!(table.connection_count(), 0);
|
||||||
assert_eq!(table.get_connection(&a2), None);
|
assert_eq!(table.get_connection(&a2), None);
|
||||||
assert_eq!(table.get_connection(&a1), None);
|
assert_eq!(table.get_connection(&a1), None);
|
||||||
assert_eq!(table.connection_count(), 0);
|
assert_eq!(table.connection_count(), 0);
|
||||||
let entry2 = table.add_connection(a1.clone(), c1.clone()).unwrap();
|
let entry2 = table.add_connection(a1, c1.clone()).unwrap();
|
||||||
assert_eq!(table.add_connection(a2.clone(), c1), Err(()));
|
assert_eq!(table.add_connection(a2.clone(), c1), Err(()));
|
||||||
let entry3 = table.add_connection(a3.clone(), c2.clone()).unwrap();
|
let entry3 = table.add_connection(a3.clone(), c2).unwrap();
|
||||||
let entry4 = table.add_connection(a4.clone(), c3.clone()).unwrap();
|
let entry4 = table.add_connection(a4.clone(), c3).unwrap();
|
||||||
assert_eq!(table.connection_count(), 3);
|
assert_eq!(table.connection_count(), 3);
|
||||||
assert_eq!(table.remove_connection(&a2), Ok(entry2.clone()));
|
assert_eq!(table.remove_connection(&a2), Ok(entry2));
|
||||||
assert_eq!(table.remove_connection(&a3), Ok(entry3.clone()));
|
assert_eq!(table.remove_connection(&a3), Ok(entry3));
|
||||||
assert_eq!(table.remove_connection(&a4), Ok(entry4.clone()));
|
assert_eq!(table.remove_connection(&a4), Ok(entry4));
|
||||||
assert_eq!(table.connection_count(), 0);
|
assert_eq!(table.connection_count(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,8 +111,8 @@ pub async fn test_eventual_value() {
|
|||||||
e1_c1.resolve(3u32);
|
e1_c1.resolve(3u32);
|
||||||
});
|
});
|
||||||
|
|
||||||
assert_eq!(i1.await, ());
|
i1.await;
|
||||||
assert_eq!(i4.await, ());
|
i4.await;
|
||||||
jh.await;
|
jh.await;
|
||||||
assert_eq!(e1.take_value(), Some(3u32));
|
assert_eq!(e1.take_value(), Some(3u32));
|
||||||
}
|
}
|
||||||
@ -126,15 +126,15 @@ pub async fn test_eventual_value() {
|
|||||||
let jh = intf::spawn(async move {
|
let jh = intf::spawn(async move {
|
||||||
let i5 = e1.instance();
|
let i5 = e1.instance();
|
||||||
let i6 = e1.instance();
|
let i6 = e1.instance();
|
||||||
assert_eq!(i1.await, ());
|
i1.await;
|
||||||
assert_eq!(i5.await, ());
|
i5.await;
|
||||||
assert_eq!(i6.await, ());
|
i6.await;
|
||||||
});
|
});
|
||||||
intf::sleep(1000).await;
|
intf::sleep(1000).await;
|
||||||
let resolved = e1_c1.resolve(4u16);
|
let resolved = e1_c1.resolve(4u16);
|
||||||
drop(i2);
|
drop(i2);
|
||||||
drop(i3);
|
drop(i3);
|
||||||
assert_eq!(i4.await, ());
|
i4.await;
|
||||||
resolved.await;
|
resolved.await;
|
||||||
jh.await;
|
jh.await;
|
||||||
assert_eq!(e1_c1.take_value(), Some(4u16));
|
assert_eq!(e1_c1.take_value(), Some(4u16));
|
||||||
@ -146,8 +146,8 @@ pub async fn test_eventual_value() {
|
|||||||
let i2 = e1.instance();
|
let i2 = e1.instance();
|
||||||
let e1_c1 = e1.clone();
|
let e1_c1 = e1.clone();
|
||||||
let jh = intf::spawn(async move {
|
let jh = intf::spawn(async move {
|
||||||
assert_eq!(i1.await, ());
|
i1.await;
|
||||||
assert_eq!(i2.await, ());
|
i2.await;
|
||||||
});
|
});
|
||||||
intf::sleep(1000).await;
|
intf::sleep(1000).await;
|
||||||
e1_c1.resolve(5u32).await;
|
e1_c1.resolve(5u32).await;
|
||||||
@ -159,8 +159,8 @@ pub async fn test_eventual_value() {
|
|||||||
let j1 = e1.instance();
|
let j1 = e1.instance();
|
||||||
let j2 = e1.instance();
|
let j2 = e1.instance();
|
||||||
let jh = intf::spawn(async move {
|
let jh = intf::spawn(async move {
|
||||||
assert_eq!(j1.await, ());
|
j1.await;
|
||||||
assert_eq!(j2.await, ());
|
j2.await;
|
||||||
});
|
});
|
||||||
intf::sleep(1000).await;
|
intf::sleep(1000).await;
|
||||||
e1_c1.resolve(6u32).await;
|
e1_c1.resolve(6u32).await;
|
||||||
|
Loading…
Reference in New Issue
Block a user