Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[inetstack] Remove some dead code #1463

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/rust/inetstack/protocols/layer4/tcp/active_open.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ use crate::{
fail::Fail,
memory::DemiBuffer,
network::{config::TcpConfig, socket::option::TcpSocketOptions},
QDesc, SharedDemiRuntime, SharedObject,
SharedDemiRuntime, SharedObject,
},
};
use ::futures::{channel::mpsc, select_biased, FutureExt};
use ::futures::{select_biased, FutureExt};
use ::std::{
net::{Ipv4Addr, SocketAddrV4},
ops::{Deref, DerefMut},
Expand Down Expand Up @@ -56,7 +56,6 @@ pub struct ActiveOpenSocket {
recv_queue: SharedAsyncQueue<(Ipv4Addr, TcpHeader, DemiBuffer)>,
tcp_config: TcpConfig,
socket_options: TcpSocketOptions,
dead_socket_tx: mpsc::UnboundedSender<QDesc>,
state: SharedAsyncValue<State>,
}

Expand All @@ -76,7 +75,6 @@ impl SharedActiveOpenSocket {
layer3_endpoint: SharedLayer3Endpoint,
tcp_config: TcpConfig,
default_socket_options: TcpSocketOptions,
dead_socket_tx: mpsc::UnboundedSender<QDesc>,
) -> Result<Self, Fail> {
// TODO: Add fast path here when remote is already in the ARP cache (and subtract one retry).

Expand All @@ -89,7 +87,6 @@ impl SharedActiveOpenSocket {
recv_queue: SharedAsyncQueue::default(),
tcp_config,
socket_options: default_socket_options,
dead_socket_tx,
state: SharedAsyncValue::new(State::Connecting),
})))
}
Expand Down Expand Up @@ -212,7 +209,6 @@ impl SharedActiveOpenSocket {
mss,
congestion_control::None::new,
None,
self.dead_socket_tx.clone(),
)?)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ use crate::{
network::{config::TcpConfig, socket::option::TcpSocketOptions},
yield_with_timeout, SharedDemiRuntime, SharedObject,
},
QDesc,
};
use ::futures::{channel::mpsc, never::Never, pin_mut, FutureExt};
use ::futures::{never::Never, pin_mut, FutureExt};
use ::std::{
net::{Ipv4Addr, SocketAddrV4},
ops::{Deref, DerefMut},
Expand Down Expand Up @@ -386,7 +385,7 @@ impl SharedControlBlock {
Ok(())
}

pub async fn background(&self, _dead_socket_tx: mpsc::UnboundedSender<QDesc>) {
pub async fn background(&self) {
let acknowledger = async_timer!(
"tcp::established::background::acknowledger",
self.clone().background_acknowledger()
Expand Down
7 changes: 3 additions & 4 deletions src/rust/inetstack/protocols/layer4/tcp/established/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ use crate::{
fail::Fail,
memory::DemiBuffer,
network::{config::TcpConfig, socket::option::TcpSocketOptions},
QDesc, SharedDemiRuntime,
SharedDemiRuntime,
},
QToken,
};
use ::futures::{channel::mpsc, FutureExt};
use ::futures::FutureExt;
use ::std::{
net::{Ipv4Addr, SocketAddrV4},
time::Duration,
Expand Down Expand Up @@ -61,7 +61,6 @@ impl EstablishedSocket {
sender_mss: usize,
cc_constructor: CongestionControlConstructor,
congestion_control_options: Option<congestion_control::Options>,
dead_socket_tx: mpsc::UnboundedSender<QDesc>,
) -> Result<Self, Fail> {
// TODO: Maybe add the queue descriptor here.
let cb = SharedControlBlock::new(
Expand All @@ -87,7 +86,7 @@ impl EstablishedSocket {
let cb2: SharedControlBlock = cb.clone();
let qt: QToken = runtime.insert_background_coroutine(
"bgc::inetstack::tcp::established::background",
Box::pin(async move { cb2.background(dead_socket_tx).await }.fuse()),
Box::pin(async move { cb2.background().await }.fuse()),
)?;
Ok(Self {
cb,
Expand Down
8 changes: 2 additions & 6 deletions src/rust/inetstack/protocols/layer4/tcp/passive_open.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ use crate::{
fail::Fail,
memory::DemiBuffer,
network::{config::TcpConfig, consts::MAX_WINDOW_SCALE, socket::option::TcpSocketOptions},
QDesc, SharedDemiRuntime, SharedObject,
SharedDemiRuntime, SharedObject,
},
};
use ::futures::{channel::mpsc, FutureExt};
use ::futures::FutureExt;
use ::libc::{EBADMSG, ETIMEDOUT};
use ::std::{
collections::HashMap,
Expand Down Expand Up @@ -68,7 +68,6 @@ pub struct PassiveSocket {
tcp_config: TcpConfig,
// We do not use these right now, but will in the future.
socket_options: TcpSocketOptions,
dead_socket_tx: mpsc::UnboundedSender<QDesc>,
}

#[derive(Clone)]
Expand All @@ -86,7 +85,6 @@ impl SharedPassiveSocket {
layer3_endpoint: SharedLayer3Endpoint,
tcp_config: TcpConfig,
default_socket_options: TcpSocketOptions,
dead_socket_tx: mpsc::UnboundedSender<QDesc>,
nonce: u32,
) -> Result<Self, Fail> {
Ok(Self(SharedObject::<PassiveSocket>::new(PassiveSocket {
Expand All @@ -100,7 +98,6 @@ impl SharedPassiveSocket {
layer3_endpoint,
tcp_config,
socket_options: default_socket_options,
dead_socket_tx,
})))
}

Expand Down Expand Up @@ -439,7 +436,6 @@ impl SharedPassiveSocket {
mss,
congestion_control::None::new,
None,
self.dead_socket_tx.clone(),
)?;

Ok(new_socket)
Expand Down
7 changes: 1 addition & 6 deletions src/rust/inetstack/protocols/layer4/tcp/peer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ use crate::{
SocketId,
},
},
QDesc, SharedDemiRuntime, SharedObject,
SharedDemiRuntime, SharedObject,
},
};
use ::futures::channel::mpsc;
use ::rand::{prelude::SmallRng, Rng, SeedableRng};

use ::std::{
Expand All @@ -45,7 +44,6 @@ pub struct TcpPeer {
tcp_config: TcpConfig,
default_socket_options: TcpSocketOptions,
rng: SmallRng,
dead_socket_tx: mpsc::UnboundedSender<QDesc>,
addresses: HashMap<SocketId, SharedTcpSocket>,
}

Expand All @@ -65,7 +63,6 @@ impl SharedTcpPeer {
) -> Result<Self, Fail> {
let mut rng: SmallRng = SmallRng::from_seed(rng_seed);
let nonce: u32 = rng.gen();
let (tx, _) = mpsc::unbounded();
Ok(Self(SharedObject::<TcpPeer>::new(TcpPeer {
isn_generator: IsnGenerator::new(nonce),
runtime,
Expand All @@ -74,7 +71,6 @@ impl SharedTcpPeer {
tcp_config: TcpConfig::new(config)?,
default_socket_options: TcpSocketOptions::new(config)?,
rng,
dead_socket_tx: tx,
addresses: HashMap::<SocketId, SharedTcpSocket>::new(),
})))
}
Expand All @@ -86,7 +82,6 @@ impl SharedTcpPeer {
self.layer3_endpoint.clone(),
self.tcp_config.clone(),
self.default_socket_options.clone(),
self.dead_socket_tx.clone(),
))
}

Expand Down
11 changes: 1 addition & 10 deletions src/rust/inetstack/protocols/layer4/tcp/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ use crate::{
SocketId,
},
},
QDesc, SharedDemiRuntime, SharedObject,
SharedDemiRuntime, SharedObject,
},
};
use ::futures::channel::mpsc;
use ::std::{
fmt::Debug,
net::{Ipv4Addr, SocketAddrV4},
Expand Down Expand Up @@ -58,7 +57,6 @@ pub struct TcpSocket {
layer3_endpoint: SharedLayer3Endpoint,
tcp_config: TcpConfig,
socket_options: TcpSocketOptions,
dead_socket_tx: mpsc::UnboundedSender<QDesc>,
}

pub struct SharedTcpSocket(SharedObject<TcpSocket>);
Expand All @@ -74,15 +72,13 @@ impl SharedTcpSocket {
layer3_endpoint: SharedLayer3Endpoint,
tcp_config: TcpConfig,
default_socket_options: TcpSocketOptions,
dead_socket_tx: mpsc::UnboundedSender<QDesc>,
) -> Self {
Self(SharedObject::<TcpSocket>::new(TcpSocket {
state: SocketState::Unbound,
runtime,
layer3_endpoint,
tcp_config,
socket_options: default_socket_options,
dead_socket_tx,
}))
}

Expand All @@ -92,15 +88,13 @@ impl SharedTcpSocket {
layer3_endpoint: SharedLayer3Endpoint,
tcp_config: TcpConfig,
default_socket_options: TcpSocketOptions,
dead_socket_tx: mpsc::UnboundedSender<QDesc>,
) -> Self {
Self(SharedObject::<TcpSocket>::new(TcpSocket {
state: SocketState::Established(socket),
runtime,
layer3_endpoint,
tcp_config,
socket_options: default_socket_options,
dead_socket_tx,
}))
}

Expand Down Expand Up @@ -157,7 +151,6 @@ impl SharedTcpSocket {
self.layer3_endpoint.clone(),
self.tcp_config.clone(),
self.socket_options.clone(),
self.dead_socket_tx.clone(),
nonce,
)?;
self.state = SocketState::Listening(passive_socket);
Expand All @@ -178,7 +171,6 @@ impl SharedTcpSocket {
self.layer3_endpoint.clone(),
self.tcp_config.clone(),
self.socket_options.clone(),
self.dead_socket_tx.clone(),
);
Ok(new_queue)
}
Expand All @@ -198,7 +190,6 @@ impl SharedTcpSocket {
self.layer3_endpoint.clone(),
self.tcp_config.clone(),
self.socket_options.clone(),
self.dead_socket_tx.clone(),
)?;
self.state = SocketState::Connecting(socket.clone());
let new_socket = socket.connect().await?;
Expand Down