diff options
author | Marcel Müller <neikos@neikos.email> | 2024-04-04 12:47:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-04 12:47:50 +0200 |
commit | c0fc75025cba765820fa1b95b896ba291591313e (patch) | |
tree | 877bd6b1f22ed78c525d352f304a08e53c31f076 | |
parent | e1d92b9e91a1ece85d878650919f201eea4ca5fe (diff) | |
parent | 9b1069f429f8067dbe0fb7112f17c9936c6453ab (diff) |
Merge pull request #274 from TheNeikos/fix/client_pingreq
Don't send a pingresp to server
-rw-r--r-- | src/client/receive.rs | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/src/client/receive.rs b/src/client/receive.rs index a239e41..4d73cd5 100644 --- a/src/client/receive.rs +++ b/src/client/receive.rs @@ -51,9 +51,7 @@ pub(super) async fn handle_background_receiving( mqtt_format::v5::packets::MqttPacket::Auth(_) => todo!(), mqtt_format::v5::packets::MqttPacket::Disconnect(_) => todo!(), mqtt_format::v5::packets::MqttPacket::Pingreq(pingreq) => { - handle_pingreq(pingreq, &inner) - .instrument(process_span) - .await? + handle_pingreq(pingreq).instrument(process_span).await? } mqtt_format::v5::packets::MqttPacket::Pingresp(pingresp) => { handle_pingresp(pingresp, &inner) @@ -116,21 +114,8 @@ async fn handle_pingresp( Ok(()) } -async fn handle_pingreq( - _pingreq: &mqtt_format::v5::packets::pingreq::MPingreq, - inner: &Arc<Mutex<InnerClient>>, -) -> Result<(), ()> { - let mut inner = inner.lock().await; - let inner = &mut *inner; - let Some(ref mut conn_state) = inner.connection_state else { - tracing::error!("No connection state found"); - todo!() - }; - - let packet = mqtt_format::v5::packets::MqttPacket::Pingresp( - mqtt_format::v5::packets::pingresp::MPingresp, - ); - conn_state.conn_write.send(packet).await.map_err(drop)?; +async fn handle_pingreq(_pingreq: &mqtt_format::v5::packets::pingreq::MPingreq) -> Result<(), ()> { + tracing::warn!("Received an unwarranted PingReq from the server. This is unclear in the spec. Ignoring and continuing..."); Ok(()) } |