From 10b88ccc60824112232d86eccbc4d75b0f791edd Mon Sep 17 00:00:00 2001 From: Aram Peres <6775216+aramperes@users.noreply.github.com> Date: Sun, 24 Dec 2023 11:23:58 -0500 Subject: [PATCH] cleanup: SockSet can be owned by static ref: https://github.com/smoltcp-rs/smoltcp/pull/813 --- src/virtual_iface/tcp.rs | 8 ++++---- src/virtual_iface/udp.rs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/virtual_iface/tcp.rs b/src/virtual_iface/tcp.rs index ff6d575..ab9ca08 100644 --- a/src/virtual_iface/tcp.rs +++ b/src/virtual_iface/tcp.rs @@ -21,14 +21,14 @@ use std::{ const MAX_PACKET: usize = 65536; /// A virtual interface for proxying Layer 7 data to Layer 3 packets, and vice-versa. -pub struct TcpVirtualInterface<'a> { +pub struct TcpVirtualInterface { source_peer_ip: IpAddr, port_forwards: Vec, bus: Bus, - sockets: SocketSet<'a>, + sockets: SocketSet<'static>, } -impl<'a> TcpVirtualInterface<'a> { +impl TcpVirtualInterface { /// Initialize the parameters for a new virtual interface. /// Use the `poll_loop()` future to start the virtual interface poll loop. pub fn new(port_forwards: Vec, bus: Bus, source_peer_ip: IpAddr) -> Self { @@ -84,7 +84,7 @@ impl<'a> TcpVirtualInterface<'a> { } #[async_trait] -impl VirtualInterfacePoll for TcpVirtualInterface<'_> { +impl VirtualInterfacePoll for TcpVirtualInterface { async fn poll_loop(mut self, mut device: VirtualIpDevice) -> anyhow::Result<()> { // Create CIDR block for source peer IP + each port forward IP let addresses = self.addresses(); diff --git a/src/virtual_iface/udp.rs b/src/virtual_iface/udp.rs index 6730c03..214c01e 100644 --- a/src/virtual_iface/udp.rs +++ b/src/virtual_iface/udp.rs @@ -20,14 +20,14 @@ use std::{ const MAX_PACKET: usize = 65536; -pub struct UdpVirtualInterface<'a> { +pub struct UdpVirtualInterface { source_peer_ip: IpAddr, port_forwards: Vec, bus: Bus, - sockets: SocketSet<'a>, + sockets: SocketSet<'static>, } -impl<'a> UdpVirtualInterface<'a> { +impl UdpVirtualInterface { /// Initialize the parameters for a new virtual interface. /// Use the `poll_loop()` future to start the virtual interface poll loop. pub fn new(port_forwards: Vec, bus: Bus, source_peer_ip: IpAddr) -> Self { @@ -96,7 +96,7 @@ impl<'a> UdpVirtualInterface<'a> { } #[async_trait] -impl<'a> VirtualInterfacePoll for UdpVirtualInterface<'a> { +impl VirtualInterfacePoll for UdpVirtualInterface { async fn poll_loop(mut self, mut device: VirtualIpDevice) -> anyhow::Result<()> { // Create CIDR block for source peer IP + each port forward IP let addresses = self.addresses();