Skip to content

Commit

Permalink
Avoid flow checks in ASGI websocket close (#416)
Browse files Browse the repository at this point in the history
  • Loading branch information
gi0baro authored Oct 15, 2024
1 parent c9e2f26 commit 6513f6e
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/asgi/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,16 +376,13 @@ impl ASGIWebsocketProtocol {
let ws_tx = self.ws_tx.clone();

future_into_py_iter(self.rt.clone(), py, async move {
match ws_tx.lock().await.take() {
Some(tx) => {
closed.store(true, atomic::Ordering::Relaxed);
WebsocketDetachedTransport::new(true, ws_rx.lock().await.take(), Some(tx))
.close()
.await;
Ok(())
}
_ => error_flow!(),
if let Some(tx) = ws_tx.lock().await.take() {
closed.store(true, atomic::Ordering::Relaxed);
WebsocketDetachedTransport::new(true, ws_rx.lock().await.take(), Some(tx))
.close()
.await;
}
Ok(())
})
}

Expand Down

0 comments on commit 6513f6e

Please sign in to comment.