mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +02:00
check for discover errors
This commit is contained in:
parent
901b0af827
commit
7c06c56700
1 changed files with 4 additions and 1 deletions
|
@ -247,12 +247,15 @@ func (c *Connection) Run() error {
|
||||||
log.Debug("checking code validity")
|
log.Debug("checking code validity")
|
||||||
if len(c.Code) == 0 && !c.IsSender {
|
if len(c.Code) == 0 && !c.IsSender {
|
||||||
log.Debug("Finding local croc relay...")
|
log.Debug("Finding local croc relay...")
|
||||||
discovered, _ := peerdiscovery.Discover(peerdiscovery.Settings{
|
discovered, errDiscover := peerdiscovery.Discover(peerdiscovery.Settings{
|
||||||
Limit: 1,
|
Limit: 1,
|
||||||
TimeLimit: 1 * time.Second,
|
TimeLimit: 1 * time.Second,
|
||||||
Delay: 50 * time.Millisecond,
|
Delay: 50 * time.Millisecond,
|
||||||
Payload: []byte(c.Code),
|
Payload: []byte(c.Code),
|
||||||
})
|
})
|
||||||
|
if errDiscover != nil {
|
||||||
|
log.Debug(errDiscover)
|
||||||
|
}
|
||||||
if len(discovered) > 0 {
|
if len(discovered) > 0 {
|
||||||
c.Server = discovered[0].Address
|
c.Server = discovered[0].Address
|
||||||
log.Debug(discovered[0].Address)
|
log.Debug(discovered[0].Address)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue