Skip to content

Commit

Permalink
Remove shutdown_complete_rx from the Listner
Browse files Browse the repository at this point in the history
Fix tokio-rs#88 remove unused field from the Listner struct
  • Loading branch information
Aklenor committed Nov 29, 2021
1 parent ebe4e1f commit 1383016
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ struct Listener {
/// complete, all clones of the `Sender` are also dropped. This results in
/// `shutdown_complete_rx.recv()` completing with `None`. At this point, it
/// is safe to exit the server process.
shutdown_complete_rx: mpsc::Receiver<()>,
shutdown_complete_tx: mpsc::Sender<()>,
}

Expand Down Expand Up @@ -135,7 +134,7 @@ pub async fn run(listener: TcpListener, shutdown: impl Future) {
// a receiver is needed, the subscribe() method on the sender is used to create
// one.
let (notify_shutdown, _) = broadcast::channel(1);
let (shutdown_complete_tx, shutdown_complete_rx) = mpsc::channel(1);
let (shutdown_complete_tx, mut shutdown_complete_rx) = mpsc::channel(1);

// Initialize the listener state
let mut server = Listener {
Expand All @@ -144,7 +143,6 @@ pub async fn run(listener: TcpListener, shutdown: impl Future) {
limit_connections: Arc::new(Semaphore::new(MAX_CONNECTIONS)),
notify_shutdown,
shutdown_complete_tx,
shutdown_complete_rx,
};

// Concurrently run the server and listen for the `shutdown` signal. The
Expand Down Expand Up @@ -188,7 +186,6 @@ pub async fn run(listener: TcpListener, shutdown: impl Future) {
// explicitly drop `shutdown_transmitter`. This is important, as the
// `.await` below would otherwise never complete.
let Listener {
mut shutdown_complete_rx,
shutdown_complete_tx,
notify_shutdown,
..
Expand Down

0 comments on commit 1383016

Please sign in to comment.