Skip to content

Commit

Permalink
removed obsolete keepalive message schema
Browse files Browse the repository at this point in the history
  • Loading branch information
babymotte committed Oct 12, 2024
1 parent 0606206 commit 43ce640
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 41 deletions.
2 changes: 1 addition & 1 deletion worterbuch-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1414,7 +1414,7 @@ async fn process_incoming_server_message(
SM::PState(pstate) => deliver_pstate(pstate, callbacks).await?,
SM::LsState(ls) => deliver_ls(ls, callbacks).await?,
SM::Err(err) => deliver_err(err, callbacks).await,
SM::Ack(_) | SM::Welcome(_) | SM::Authorized(_) | SM::Keepalive => (),
SM::Ack(_) | SM::Welcome(_) | SM::Authorized(_) => (),
}
Ok(ControlFlow::Continue(()))
}
Expand Down
3 changes: 0 additions & 3 deletions worterbuch-common/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ pub enum ClientMessage {
SubscribeLs(SubscribeLs),
UnsubscribeLs(UnsubscribeLs),
Transform(Transform),
#[serde(rename = "")]
Keepalive,
}

impl ClientMessage {
Expand All @@ -64,7 +62,6 @@ impl ClientMessage {
ClientMessage::SubscribeLs(m) => Some(m.transaction_id),
ClientMessage::UnsubscribeLs(m) => Some(m.transaction_id),
ClientMessage::Transform(m) => Some(m.transaction_id),
ClientMessage::Keepalive => None,
}
}
}
Expand Down
34 changes: 1 addition & 33 deletions worterbuch-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ pub fn digest_token(auth_token: &Option<String>, client_id: String) -> Option<St

#[cfg(test)]
mod test {
use crate::{ClientMessage, ErrorCode, ServerMessage};
use crate::ErrorCode;
use std::cmp::Ordering;

#[test]
Expand Down Expand Up @@ -351,38 +351,6 @@ mod test {
);
}

#[test]
fn server_keepalive_can_be_serialized() {
assert_eq!(
r#""""#,
serde_json::to_string(&ServerMessage::Keepalive).unwrap()
);
}

#[test]
fn server_keepalive_can_be_deserialized() {
assert_eq!(
ServerMessage::Keepalive,
serde_json::from_str(r#""""#).unwrap()
);
}

#[test]
fn client_keepalive_can_be_serialized() {
assert_eq!(
r#""""#,
serde_json::to_string(&ClientMessage::Keepalive).unwrap()
);
}

#[test]
fn client_keepalive_can_be_deserialized() {
assert_eq!(
ClientMessage::Keepalive,
serde_json::from_str(r#""""#).unwrap()
);
}

#[test]
fn error_codes_are_serialized_as_numbers() {
assert_eq!(
Expand Down
3 changes: 0 additions & 3 deletions worterbuch-common/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ pub enum ServerMessage {
Err(Err),
Authorized(Ack),
LsState(LsState),
#[serde(rename = "")]
Keepalive,
}

impl ServerMessage {
Expand All @@ -48,7 +46,6 @@ impl ServerMessage {
ServerMessage::Err(msg) => Some(msg.transaction_id),
ServerMessage::LsState(msg) => Some(msg.transaction_id),
ServerMessage::Authorized(_) => Some(0),
ServerMessage::Keepalive => None,
}
}
}
Expand Down
1 change: 0 additions & 1 deletion worterbuch/src/server/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ pub async fn process_incoming_message(
// TODO
return Ok((false, authorized));
}
CM::Keepalive => (),
},
Ok(None) => {
// client disconnected
Expand Down

0 comments on commit 43ce640

Please sign in to comment.