1
1
Fork 0
mirror of https://github.com/schollz/croc.git synced 2025-10-11 13:21:00 +02:00

bug fix: propogate error when connecting

This commit is contained in:
Zack Scholl 2020-09-02 09:46:31 -07:00
parent a8c5bef7c0
commit ea781e569b

View file

@ -517,7 +517,8 @@ func (c *Client) Receive() (err error) {
if address == "" { if address == "" {
continue continue
} }
host, port, err := net.SplitHostPort(address) var host, port string
host, port, err = net.SplitHostPort(address)
if err != nil { if err != nil {
log.Errorf("bad relay address %s", address) log.Errorf("bad relay address %s", address)
continue continue
@ -536,14 +537,13 @@ func (c *Client) Receive() (err error) {
} }
log.Debugf("could not establish '%s'", address) log.Debugf("could not establish '%s'", address)
} }
log.Debugf("banner: %s", banner)
if err != nil { if err != nil {
err = fmt.Errorf("could not connect to %s: %w", c.Options.RelayAddress, err) err = fmt.Errorf("could not connect to %s: %w", c.Options.RelayAddress, err)
log.Debug(err) log.Debug(err)
return return
} }
log.Debugf("receiver connection established: %+v", c.conn[0]) log.Debugf("receiver connection established: %+v", c.conn[0])
log.Debugf("banner: %s", banner)
if !usingLocal && !c.Options.DisableLocal { if !usingLocal && !c.Options.DisableLocal {
// ask the sender for their local ips and port // ask the sender for their local ips and port