🚨 clean up clippy warnings

main
_ 2021-10-10 17:22:04 +00:00
parent c002665f6c
commit 68eb6f911b
3 changed files with 6 additions and 4 deletions

View File

@ -10,6 +10,7 @@ use hyper::{
StatusCode, StatusCode,
}; };
use structopt::StructOpt; use structopt::StructOpt;
use tokio::sync::watch;
use quic_demo::prelude::*; use quic_demo::prelude::*;
use protocol::PeerId; use protocol::PeerId;
@ -56,6 +57,8 @@ async fn main () -> anyhow::Result <()> {
let tcp_port = 30382; let tcp_port = 30382;
let tcp_listener = TcpListener::bind (("127.0.0.1", tcp_port)).await?; let tcp_listener = TcpListener::bind (("127.0.0.1", tcp_port)).await?;
let (_running_tx, running_rx) = watch::channel (true);
let task_quic_server = { let task_quic_server = {
let relay_state = Arc::clone (&relay_state); let relay_state = Arc::clone (&relay_state);
tokio::spawn (async move { tokio::spawn (async move {
@ -89,8 +92,7 @@ async fn main () -> anyhow::Result <()> {
let task_tcp_server = { let task_tcp_server = {
let relay_state = Arc::clone (&relay_state); let relay_state = Arc::clone (&relay_state);
tokio::spawn (async move { tokio::spawn (async move {
let running = true; while *running_rx.borrow () {
while running {
let (tcp_socket, _) = tcp_listener.accept ().await?; let (tcp_socket, _) = tcp_listener.accept ().await?;
let relay_state = Arc::clone (&relay_state); let relay_state = Arc::clone (&relay_state);

View File

@ -61,7 +61,7 @@ pub async fn p2_connect_to_p5 (
let cmd_type = Command::CONNECT_P2_TO_P4.0; let cmd_type = Command::CONNECT_P2_TO_P4.0;
send.write_all (&[cmd_type, 0, 0, 0]).await?; send.write_all (&[cmd_type, 0, 0, 0]).await?;
send_lv_string (&mut send, &server_id).await?; send_lv_string (&mut send, server_id).await?;
expect_exact_response (&mut recv, [Command::OKAY.0, cmd_type, 0, 0]).await expect_exact_response (&mut recv, [Command::OKAY.0, cmd_type, 0, 0]).await
.context ("P2 didn't get OK response when asking P3 to connect P2 to P4")?; .context ("P2 didn't get OK response when asking P3 to connect P2 to P4")?;

View File

@ -58,7 +58,7 @@ pub fn make_server_endpoint(bind_addr: SocketAddr) -> anyhow::Result<(Incoming,
fn configure_client(server_certs: &[&[u8]]) -> anyhow::Result<ClientConfig> { fn configure_client(server_certs: &[&[u8]]) -> anyhow::Result<ClientConfig> {
let mut cfg_builder = ClientConfigBuilder::default(); let mut cfg_builder = ClientConfigBuilder::default();
for cert in server_certs { for cert in server_certs {
cfg_builder.add_certificate_authority(Certificate::from_der(&cert)?)?; cfg_builder.add_certificate_authority(Certificate::from_der(cert)?)?;
} }
Ok(cfg_builder.build()) Ok(cfg_builder.build())
} }