Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove shutdown_complete_rx from the Listner #89

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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