Network detection proper action on IP new and remove. Close #2

This commit is contained in:
Kleissner
2021-03-02 13:40:29 +01:00
parent 76e4114be9
commit 73e1643548
2 changed files with 37 additions and 3 deletions

View File

@@ -159,12 +159,16 @@ func networkPrepareListen(ipA string, port int) (network *Network, err error) {
return nil, err
}
networksMutex.Lock()
// Success - port is open. Add to the list and start accepting incoming messages.
if IsIPv4(ip) {
networks4 = append(networks4, network)
networksMutex.Unlock()
network.BroadcastIPv4()
} else {
networks6 = append(networks6, network)
networksMutex.Unlock()
network.MulticastIPv6Join()
}