1
0
mirror of https://github.com/schollz/croc.git synced 2024-11-24 16:23:47 +03:00

gather all discoveries

This commit is contained in:
Zack Scholl 2020-10-22 09:53:27 -07:00
parent 1d9393d39b
commit 3bcc83a8fc

View File

@ -507,7 +507,7 @@ func (c *Client) Receive() (err error) {
if err1 == nil && len(ipv4discoveries) > 0 {
dmux.Lock()
err = err1
discoveries = ipv4discoveries
discoveries = append(discoveries, ipv4discoveries...)
dmux.Unlock()
}
}()
@ -523,13 +523,14 @@ func (c *Client) Receive() (err error) {
if err1 == nil && len(ipv6discoveries) > 0 {
dmux.Lock()
err = err1
discoveries = ipv6discoveries
discoveries = append(discoveries, ipv6discoveries...)
dmux.Unlock()
}
}()
wgDiscovery.Wait()
if err == nil && len(discoveries) > 0 {
log.Debugf("all discoveries: %+v", discoveries)
for i := 0; i < len(discoveries); i++ {
log.Debugf("discovery %d has payload: %+v", i, discoveries[i])
if !bytes.HasPrefix(discoveries[i].Payload, []byte("croc")) {