network fixes, still a lot more to do for tcp

This commit is contained in:
John Smith
2022-01-01 13:38:39 -05:00
parent 0e0209a54b
commit c2c5e3c299
10 changed files with 30 additions and 20 deletions

View File

@@ -15,7 +15,7 @@ pub enum BumpPortType {
pub fn tcp_port_available(addr: &SocketAddr) -> bool {
cfg_if! {
if #[cfg(target_arch = "wasm32")] {
false
true
} else {
match TcpListener::bind(addr) {
Ok(_) => true,
@@ -28,7 +28,7 @@ pub fn tcp_port_available(addr: &SocketAddr) -> bool {
pub fn udp_port_available(addr: &SocketAddr) -> bool {
cfg_if! {
if #[cfg(target_arch = "wasm32")] {
false
true
} else {
match UdpSocket::bind(addr) {
Ok(_) => true,