Ensure port is non zero in discovery

This commit is contained in:
QuantumEntangledAndy committed 2023-08-03 18:08:34 +07:00
1 parent 2f557f777d
commit e3b057f915
1 file changed
+24 -6
@@ -445,9 +445,18 @@ impl Discoverer {
}),
..
},
} if (dev.as_ref().map(|d| !d.ip.is_empty()).unwrap_or(false)
|| dmap.as_ref().map(|d| !d.ip.is_empty()).unwrap_or(false)
|| relay.as_ref().map(|d| !d.ip.is_empty()).unwrap_or(false))
} if (dev
.as_ref()
.map(|d| !d.ip.is_empty() && d.port > 0)
.unwrap_or(false)
|| dmap
.as_ref()
.map(|d| !d.ip.is_empty() && d.port > 0)
.unwrap_or(false)
|| relay
.as_ref()
.map(|d| !d.ip.is_empty() && d.port > 0)
.unwrap_or(false))
&& rsp != -1 =>
{
Some(Ok((sid, dev, dmap, relay)))
@@ -466,9 +475,18 @@ impl Discoverer {
}),
..
},
} if (dev.as_ref().map(|d| !d.ip.is_empty()).unwrap_or(false)
|| dmap.as_ref().map(|d| !d.ip.is_empty()).unwrap_or(false)
|| relay.as_ref().map(|d| !d.ip.is_empty()).unwrap_or(false))
} if (dev
.as_ref()
.map(|d| !d.ip.is_empty() && d.port > 0)
.unwrap_or(false)
|| dmap
.as_ref()
.map(|d| !d.ip.is_empty() && d.port > 0)
.unwrap_or(false)
|| relay
.as_ref()
.map(|d| !d.ip.is_empty() && d.port > 0)
.unwrap_or(false))
&& rsp == -1 =>
{
Some(Err(Error::RegisterError))