schollz / peerdiscovery

Pure-Go library for cross-platform local peer discovery using UDP multicast :woman: :repeat: :woman:
MIT License
644 stars 56 forks source link

Listen socket keeps opened indefinitely when stopped via StopChan #28

Closed fzwoch closed 2 years ago

fzwoch commented 2 years ago

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.

fzwoch commented 2 years ago

Closed via #29