Skip to content

Commit

Permalink
Fix RPCUtil not checking for the interface before looking for it (#849)
Browse files Browse the repository at this point in the history
  • Loading branch information
ImUrX authored Sep 20, 2023
1 parent 4dc8ce9 commit 7a37773
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ object RPCUtil {
@JvmStatic
fun getLocalIp(): String =
NetworkInterface.getNetworkInterfaces().asSequence().first { netInt ->
netInt.isUp && !netInt.isLoopback && !netInt.isVirtual && netInt.interfaceAddresses.any { it.broadcast != null }
netInt.isUp && !netInt.isLoopback && !netInt.isVirtual && netInt.interfaceAddresses.any { it.address.isSiteLocalAddress && it.broadcast != null }
}.interfaceAddresses.first {
it.address.isSiteLocalAddress && it.broadcast != null
}.address.hostAddress
Expand Down

0 comments on commit 7a37773

Please sign in to comment.