Closed jainpiyush19 closed 5 years ago
@piyushzomato Could you post an example that I could run that reproduces the bug?
Please find below the sample code.
func test() {
ticker := time.NewTicker(time.Second * 5)
for {
select {
case <-ticker.C:
discoveries, _ := peerdiscovery.Discover(peerdiscovery.Settings{
Limit: 10,
TimeLimit: time.Second * 4,
Delay: time.Second * 2,
AllowSelf: false,
})
fmt.Println("Discovered Devices")
for _, d := range discoveries {
fmt.Println("Device : ", d)
}
}
}
}
@piyushzomato Its running fine for me, 7+ minutes
It happens randomly. Try running it multiple times.
@piyushzomato How many times? How many iterations does it go until it fails?
I tried executing
peerdiscovery.Discover()
function in a loop and it stucks randomly after some time. After a little debugging, my hunch is, this is due to connection not being closed inlisten()
function. Please let me know if this is the actual reason or it is because of something else.