LAN plugin fails to bind IPv4 server socket when wifi is enabled
On the Nexus 5X (Android 8.1), the LAN plugin fails to bind an IPv4 server socket when the device's wifi is disabled and then re-enabled.
The AndroidNetworkManager broadcasts two connectivity events when wifi is re-enabled. The first seems to be broadcast before the device has received a DHCP address, the second after the address is received. The plugin responds to the first event by trying to bind IPv4 and IPv6 sockets. It fails to bind an IPv4 socket because the wifi interface doesn't have an IPv4 address yet. The plugin doesn't try to bind again in response to the second event because it's already in the ACTIVE state due to having bound an IPv6 socket.
The bug doesn't happen on the Pixel 2 (Android 11 beta). Only one connectivity event is broadcast when wifi is re-enabled, and this seems to happen after the interface has an IPv4 address.