Skip to content

Commit

Permalink
Changed connect to return the error if any, and success otherwise
Browse files Browse the repository at this point in the history
  • Loading branch information
OutOfBears committed Mar 1, 2021
1 parent 683bd62 commit 88c8920
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions gsbot/gsbot.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ func (s *ServerList) ConnectBind(laddr *net.TCPAddr) (bool, error) {
d, err := ioutil.ReadFile(s.listPath)
if err != nil {
s.bot.Log.Println("Connecting to random server.")
s.bot.Client.Connect()
return false, nil
_, err := s.bot.Client.Connect()
return err == nil, err
}
var addrs []*netutil.PortAddr
err = json.Unmarshal(d, &addrs)
Expand All @@ -146,8 +146,8 @@ func (s *ServerList) ConnectBind(laddr *net.TCPAddr) (bool, error) {
}
raddr := addrs[rand.Intn(len(addrs))]
s.bot.Log.Printf("Connecting to %v from server list\n", raddr)
s.bot.Client.ConnectToBind(raddr, laddr)
return true, nil
err = s.bot.Client.ConnectToBind(raddr, laddr)
return err == nil, err
}

// This module logs incoming packets and events to a directory.
Expand Down

0 comments on commit 88c8920

Please sign in to comment.