Skip to content

Commit

Permalink
make linter happy
Browse files Browse the repository at this point in the history
  • Loading branch information
emillynge committed Jan 13, 2022
1 parent 24ef063 commit 7ca0451
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
6 changes: 2 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ use config_watcher::ServiceChange;
pub use constants::UDP_BUFFER_SIZE;

use anyhow::Result;
use clap::arg;
use tokio::join;
use tokio::sync::{broadcast, mpsc};
use tracing::{debug, info};

Expand Down Expand Up @@ -113,8 +111,8 @@ pub async fn run(args: Cli, shutdown_rx: broadcast::Receiver<bool>) -> Result<()
}

let _ = shutdown_tx.send(true);
if let Some((h,sender)) = last_instance{
h.await;
if let Some((h,_)) = last_instance{
h.await?;
}
Ok(())
}
Expand Down
16 changes: 5 additions & 11 deletions src/transport/quic.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
use std::borrow::{Borrow, BorrowMut};
use std::borrow::{BorrowMut};
use std::fmt::{Debug, Formatter};
use std::io;
use std::io::{Error, IoSlice};
use std::net::SocketAddr;
use std::ops::Deref;
use std::ops::DerefMut;
use std::pin::Pin;
use std::sync::Arc;
use std::task::Poll;
Expand All @@ -16,16 +13,13 @@ use anyhow::{anyhow, Context, Result};
use async_trait::async_trait;
use futures_util::{StreamExt};
use openssl::pkcs12::Pkcs12;
use quinn::{Connecting, Connection, Endpoint, EndpointConfig, Incoming, NewConnection};
use rustls::internal::msgs::codec::Codec;
use rustls::ClientConfig;
use quinn::{Connecting, Connection, Endpoint, EndpointConfig, Incoming};
use tokio::fs;
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
use tokio::io::{AsyncWrite, ReadBuf};
use tokio::net::{ToSocketAddrs, UdpSocket};
use tokio_native_tls::native_tls::Certificate;

pub const ALPN_QUIC_TUNNEL: &[&[u8]] = &[b"qt"];
pub const NONE: &str = "None";

pub struct QuicTransport {
config: TlsConfig,
Expand All @@ -51,7 +45,7 @@ pub struct QuicBiStream {
}

impl QuicBiStream {
fn new((mut send, recv): (quinn::SendStream, quinn::RecvStream), conn: Connection) -> Self {
fn new((send, recv): (quinn::SendStream, quinn::RecvStream), conn: Connection) -> Self {
Self { send, recv, conn}
}
}
Expand Down Expand Up @@ -143,7 +137,7 @@ impl Transport for QuicTransport {
roots.add(&rustls::Certificate(
cert.to_der()
.with_context(|| "could not encode trust root as DER")?,
));
)).with_context(|| "adding trusted root cert to trust store")?;

let mut client_crypto = rustls::ClientConfig::builder()
.with_safe_defaults()
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ async fn test(config_path: &'static str, t: Type) -> Result<()> {
// Simulate the server crash and restart
info!("shutdown the server");
server_shutdown_tx.send(true)?;
let j = tokio::join!(server);
let _ = tokio::join!(server);

info!("restart the server");
let server_shutdown_rx = server_shutdown_tx.subscribe();
Expand Down

0 comments on commit 7ca0451

Please sign in to comment.