When using StopChan to stop the discovery the listen() function never returns and therefore keeps the socket opened indefinitely.
I was able to quickly hack it in a way so that the local exit variable was part of the peerDiscovery type and listen() would check if that variable is set and quits.
Not sure if that's nice though. Also, in case no more peer discoveries are happening that function would still sit there forever with its socket listening for valid data.
When using StopChan to stop the discovery the
listen()
function never returns and therefore keeps the socket opened indefinitely.I was able to quickly hack it in a way so that the local
exit
variable was part of thepeerDiscovery
type andlisten()
would check if that variable is set and quits.Not sure if that's nice though. Also, in case no more peer discoveries are happening that function would still sit there forever with its socket listening for valid data.