From 439174417a59fca82a249ac2cdd5c746c991be90 Mon Sep 17 00:00:00 2001 From: Greg Heartsfield Date: Wed, 24 Nov 2021 15:15:56 -0600 Subject: [PATCH] Correct length check for Close messages --- src/close.rs | 2 +- src/main.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/close.rs b/src/close.rs index 4f79281..783c650 100644 --- a/src/close.rs +++ b/src/close.rs @@ -29,7 +29,7 @@ impl<'de> Deserialize<'de> for Close { .ok_or(serde::de::Error::custom("not array"))?; // check length - if va.len() == 2 { + if va.len() != 2 { return Err(serde::de::Error::custom("not exactly 2 fields")); } let mut i = va.into_iter(); diff --git a/src/main.rs b/src/main.rs index 7d249af..b33f668 100644 --- a/src/main.rs +++ b/src/main.rs @@ -87,8 +87,8 @@ async fn process_client(stream: WebSocketStream) { ))) .await .expect("send failed"); + // Handle this request. Everything else below is basically websocket error handling. proto.process_message(cmd); - // Handle this request. Everything else below is basically error handling. } Ok(Message::Binary(_)) => { info!("Ignoring Binary message");