Skip to content

Commit 1383016

Browse files
committed
Remove shutdown_complete_rx from the Listner
Fix tokio-rs#88 remove unused field from the Listner struct
1 parent ebe4e1f commit 1383016

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/server.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ struct Listener {
6060
/// complete, all clones of the `Sender` are also dropped. This results in
6161
/// `shutdown_complete_rx.recv()` completing with `None`. At this point, it
6262
/// is safe to exit the server process.
63-
shutdown_complete_rx: mpsc::Receiver<()>,
6463
shutdown_complete_tx: mpsc::Sender<()>,
6564
}
6665

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

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

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

0 commit comments

Comments
 (0)