Skip to content

Commit

Permalink
Avoid protocol errors in ASGI and RSGI on ws pong recv (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
gi0baro authored Jun 7, 2024
1 parent 2a006a0 commit 8378b36
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/asgi/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ impl ASGIWebsocketProtocol {
if let Some(ws) = &mut *(transport.lock().await) {
while let Some(recv) = ws.next().await {
match recv {
Ok(Message::Ping(_)) => continue,
Ok(Message::Ping(_) | Message::Pong(_)) => continue,
Ok(message @ Message::Close(_)) => {
closed.store(true, atomic::Ordering::Relaxed);
return ws_message_into_py(message);
Expand Down
2 changes: 1 addition & 1 deletion src/rsgi/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ impl RSGIWebsocketTransport {
if let Ok(mut stream) = transport.try_lock() {
while let Some(recv) = stream.next().await {
match recv {
Ok(Message::Ping(_)) => continue,
Ok(Message::Ping(_) | Message::Pong(_)) => continue,
Ok(message) => return message_into_py(message),
_ => break,
}
Expand Down

0 comments on commit 8378b36

Please sign in to comment.