Made clippy happier
This commit is contained in:
@@ -77,7 +77,7 @@ impl<'a> ConnectionManager<'a> {
|
||||
return match conn_writer.write_all(msg).await {
|
||||
// if we failed to write to connection we should reconnect
|
||||
// TODO: is this true? can we fail to write to a connection while it still remains open and valid?
|
||||
Ok(res) => Ok(res),
|
||||
Ok(_) => Ok(()),
|
||||
Err(e) => {
|
||||
trace!("Creating connection reconnector!");
|
||||
self.state = ConnectionState::Reconnecting(ConnectionReconnector::new(
|
||||
|
||||
@@ -121,8 +121,8 @@ impl MixIdentityPrivateKey {
|
||||
|
||||
// TODO: this will be implemented differently by using the proper trait
|
||||
impl MixIdentityPrivateKey {
|
||||
pub fn as_scalar(self) -> Scalar {
|
||||
let encryption_key = self.0;
|
||||
pub fn as_scalar(&self) -> Scalar {
|
||||
let encryption_key = &self.0;
|
||||
encryption_key.0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ async fn process_socket_connection(
|
||||
|
||||
// we must be able to handle multiple packets from same connection independently
|
||||
tokio::spawn(process_received_packet(
|
||||
buf.clone(),
|
||||
buf,
|
||||
// note: processing_data is relatively cheap (and safe) to clone -
|
||||
// it contains arc to private key and metrics reporter (which is just
|
||||
// a single mpsc unbounded sender)
|
||||
|
||||
@@ -83,7 +83,7 @@ impl NymClient {
|
||||
.providers()
|
||||
.iter()
|
||||
.find(|provider| provider.pub_key == provider_id)
|
||||
.expect(format!("Could not find provider with id {:?} - are you sure it is still online? Perhaps try to run `nym-client init` again to obtain a new provider", provider_id).as_ref())
|
||||
.unwrap_or_else( || panic!("Could not find provider with id {:?} - are you sure it is still online? Perhaps try to run `nym-client init` again to obtain a new provider", provider_id))
|
||||
.client_listener
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ async fn process_request(
|
||||
.map(|c| c.into_tuple())
|
||||
.unzip();
|
||||
let response_bytes = PullResponse::new(messages).to_bytes();
|
||||
if let Ok(_) = socket.write_all(&response_bytes).await {
|
||||
if socket.write_all(&response_bytes).await.is_ok() {
|
||||
// only delete stored messages if we managed to actually send the response
|
||||
if let Err(e) = request_processor.delete_sent_messages(paths).await {
|
||||
error!("Somehow failed to delete stored messages! - {:?}", e);
|
||||
|
||||
@@ -85,27 +85,26 @@ impl RequestProcessor {
|
||||
);
|
||||
|
||||
let auth_token = self.generate_new_auth_token(req.destination_address.clone());
|
||||
if let Some(_) = self
|
||||
if self
|
||||
.client_ledger
|
||||
.insert_token(auth_token.clone(), req.destination_address.clone())
|
||||
.await
|
||||
.is_some()
|
||||
{
|
||||
info!(
|
||||
"Client {:?} was already registered before!",
|
||||
req.destination_address.to_base58_string()
|
||||
)
|
||||
} else {
|
||||
if let Err(e) = self
|
||||
.client_storage
|
||||
.create_storage_dir(req.destination_address.clone())
|
||||
.await
|
||||
{
|
||||
error!("We failed to create inbox directory for the client -{:?}\nReverting issued token...", e);
|
||||
// we must revert our changes if this operation failed
|
||||
self.client_ledger
|
||||
.remove_token(&req.destination_address)
|
||||
.await;
|
||||
}
|
||||
} else if let Err(e) = self
|
||||
.client_storage
|
||||
.create_storage_dir(req.destination_address.clone())
|
||||
.await
|
||||
{
|
||||
error!("We failed to create inbox directory for the client -{:?}\nReverting issued token...", e);
|
||||
// we must revert our changes if this operation failed
|
||||
self.client_ledger
|
||||
.remove_token(&req.destination_address)
|
||||
.await;
|
||||
}
|
||||
|
||||
Ok(ClientProcessingResult::RegisterResponse(auth_token))
|
||||
|
||||
@@ -42,10 +42,7 @@ async fn process_socket_connection(
|
||||
}
|
||||
|
||||
// we must be able to handle multiple packets from same connection independently
|
||||
tokio::spawn(process_received_packet(
|
||||
buf.clone(),
|
||||
packet_processor.clone(),
|
||||
))
|
||||
tokio::spawn(process_received_packet(buf, packet_processor.clone()))
|
||||
}
|
||||
Err(e) => {
|
||||
warn!(
|
||||
|
||||
Reference in New Issue
Block a user