From 8e4c76b1c5897fb13131a825a53402ac4dd2b2c5 Mon Sep 17 00:00:00 2001 From: Timon Date: Wed, 20 Oct 2021 15:51:22 +0200 Subject: [PATCH] Remove congestion control, since its results are never exposed or used internally. (#302) --- src/infrastructure.rs | 2 -- src/net.rs | 2 -- src/net/virtual_connection.rs | 27 ++++++++++++++++----------- src/sequence_buffer.rs | 2 -- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/infrastructure.rs b/src/infrastructure.rs index de6a8c5c..d3c068c5 100644 --- a/src/infrastructure.rs +++ b/src/infrastructure.rs @@ -3,11 +3,9 @@ pub use self::acknowledgment::AcknowledgmentHandler; pub use self::acknowledgment::SentPacket; -pub use self::congestion::CongestionHandler; pub use self::fragmenter::Fragmentation; mod acknowledgment; -mod congestion; mod fragmenter; pub mod arranging; diff --git a/src/net.rs b/src/net.rs index 7b7a5949..ecd466c9 100644 --- a/src/net.rs +++ b/src/net.rs @@ -5,7 +5,6 @@ pub use self::connection::{Connection, ConnectionEventAddress, ConnectionMesseng pub use self::connection_manager::{ConnectionManager, DatagramSocket}; pub use self::events::SocketEvent; pub use self::link_conditioner::LinkConditioner; -pub use self::quality::{NetworkQuality, RttMeasurer}; pub use self::socket::Socket; pub use self::virtual_connection::VirtualConnection; @@ -14,7 +13,6 @@ mod connection_impl; mod connection_manager; mod events; mod link_conditioner; -mod quality; mod socket; mod virtual_connection; diff --git a/src/net/virtual_connection.rs b/src/net/virtual_connection.rs index dd47501a..346ae7b8 100644 --- a/src/net/virtual_connection.rs +++ b/src/net/virtual_connection.rs @@ -7,7 +7,7 @@ use crate::{ error::{ErrorKind, PacketErrorKind, Result}, infrastructure::{ arranging::{Arranging, ArrangingSystem, OrderingSystem, SequencingSystem}, - AcknowledgmentHandler, CongestionHandler, Fragmentation, SentPacket, + AcknowledgmentHandler, Fragmentation, SentPacket, }, net::constants::{ ACKED_PACKET_HEADER, DEFAULT_ORDERING_STREAM, DEFAULT_SEQUENCING_STREAM, @@ -35,7 +35,6 @@ pub struct VirtualConnection { ordering_system: OrderingSystem<(Box<[u8]>, PacketType)>, sequencing_system: SequencingSystem>, acknowledge_handler: AcknowledgmentHandler, - congestion_handler: CongestionHandler, config: Config, fragmentation: Fragmentation, @@ -53,7 +52,6 @@ impl VirtualConnection { ordering_system: OrderingSystem::new(), sequencing_system: SequencingSystem::new(), acknowledge_handler: AcknowledgmentHandler::new(), - congestion_handler: CongestionHandler::new(config), fragmentation: Fragmentation::new(config), config: config.to_owned(), } @@ -113,8 +111,9 @@ impl VirtualConnection { DeliveryGuarantee::Unreliable => { if packet.payload.len() <= self.config.receive_buffer_max_size { if packet.packet_type == PacketType::Heartbeat { - self.congestion_handler - .process_outgoing(self.acknowledge_handler.local_sequence_num(), time); + // TODO: implement congestion control. + // self.congestion_handler + // .process_outgoing(self.acknowledge_handler.local_sequence_num(), time); } let mut builder = OutgoingPacketBuilder::new(packet.payload) @@ -232,8 +231,10 @@ impl VirtualConnection { } }; - self.congestion_handler - .process_outgoing(self.acknowledge_handler.local_sequence_num(), time); + // TODO: implement congestion control. + // self.congestion_handler + // .process_outgoing(self.acknowledge_handler.local_sequence_num(), time); + self.acknowledge_handler.process_outgoing( packet.packet_type, packet.payload, @@ -316,8 +317,10 @@ impl VirtualConnection { acked_header, ) { Ok(Some((payload, acked_header))) => { - self.congestion_handler - .process_incoming(acked_header.sequence()); + // TODO: implement congestion control. + // self.congestion_handler + // .process_incoming(acked_header.sequence()); + self.acknowledge_handler.process_incoming( acked_header.sequence(), acked_header.ack_seq(), @@ -341,8 +344,10 @@ impl VirtualConnection { } else { let acked_header = packet_reader.read_acknowledge_header()?; - self.congestion_handler - .process_incoming(acked_header.sequence()); + // TODO: implement congestion control. + // self.congestion_handler + // .process_incoming(acked_header.sequence()); + self.acknowledge_handler.process_incoming( acked_header.sequence(), acked_header.ack_seq(), diff --git a/src/sequence_buffer.rs b/src/sequence_buffer.rs index 5ff441e7..d28f5079 100644 --- a/src/sequence_buffer.rs +++ b/src/sequence_buffer.rs @@ -2,10 +2,8 @@ use std::clone::Clone; use crate::packet::SequenceNumber; -pub use self::congestion_data::CongestionData; pub use self::reassembly_data::ReassemblyData; -mod congestion_data; mod reassembly_data; /// Collection to store data of any kind.