Fix reliable messages, again

This commit is contained in:
Sofia 2026-07-16 16:46:24 +03:00
parent ad697b21b7
commit 2721021f7b

View File

@ -333,13 +333,13 @@ impl<T: std::fmt::Debug + Clone + Serialize + DeserializeOwned + Send + Sync + '
// already seen // already seen
println!("{:?}", conn.reliable_queue); println!("{:?}", conn.reliable_queue);
println!("{:?}", msgs.ack); println!("{:?}", msgs.ack);
conn.reliable_queue.retain(|v| v.message_id >= msgs.ack); conn.reliable_queue.retain(|v| v.message_id > msgs.ack);
// Process all messages that have not been previously seen // Process all messages that have not been previously seen
// before, that is to say the connection's ack value is // before, that is to say the connection's ack value is
// lower than the message's id // lower than the message's id
for reliable_msg in &msgs.reliable { for reliable_msg in &msgs.reliable {
if reliable_msg.message_id >= conn.ack { if reliable_msg.message_id > conn.ack {
messages.push(PeerMessage::Message( messages.push(PeerMessage::Message(
conn.clone(), conn.clone(),
reliable_msg.message.clone(), reliable_msg.message.clone(),
@ -531,7 +531,7 @@ impl<T: Clone> Connection<T> {
last_recv_close: Instant::now(), last_recv_close: Instant::now(),
closing_since: Instant::now(), closing_since: Instant::now(),
message_counter: 0, message_counter: 1,
ack: 0, ack: 0,
reliable_queue: Vec::new(), reliable_queue: Vec::new(),
last_msg_send: Instant::now() - Duration::from_hours(1), last_msg_send: Instant::now() - Duration::from_hours(1),