Cleanup usage of anyhow with_context

This commit is contained in:
Aram 🍐 2023-12-24 15:05:33 -05:00
parent 3ccd000ea8
commit ce40f85efa
9 changed files with 55 additions and 69 deletions

View file

@ -56,7 +56,7 @@ impl TcpVirtualInterface {
IpAddress::from(port_forward.destination.ip()),
port_forward.destination.port(),
))
.with_context(|| "Virtual server socket failed to listen")?;
.context("Virtual server socket failed to listen")?;
Ok(socket)
}
@ -218,7 +218,7 @@ impl VirtualInterfacePoll for TcpVirtualInterface {
),
(IpAddress::from(self.source_peer_ip), virtual_port.num()),
)
.with_context(|| "Virtual server socket failed to listen")?;
.context("Virtual server socket failed to listen")?;
next_poll = None;
}

View file

@ -61,7 +61,7 @@ impl UdpVirtualInterface {
IpAddress::from(port_forward.destination.ip()),
port_forward.destination.port(),
))
.with_context(|| "UDP virtual server socket failed to bind")?;
.context("UDP virtual server socket failed to bind")?;
Ok(socket)
}
@ -78,7 +78,7 @@ impl UdpVirtualInterface {
let mut socket = udp::Socket::new(udp_rx_buffer, udp_tx_buffer);
socket
.bind((IpAddress::from(source_peer_ip), client_port.num()))
.with_context(|| "UDP virtual client failed to bind")?;
.context("UDP virtual client failed to bind")?;
Ok(socket)
}