From 88c89208508b5fdc46cc393a5814127f6a435a02 Mon Sep 17 00:00:00 2001 From: Jack Fox <0xdeadbeef1@gmail.com> Date: Sun, 28 Feb 2021 20:08:20 -0500 Subject: [PATCH] Changed connect to return the error if any, and success otherwise --- gsbot/gsbot.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gsbot/gsbot.go b/gsbot/gsbot.go index ddcd1af6..809034a3 100644 --- a/gsbot/gsbot.go +++ b/gsbot/gsbot.go @@ -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) @@ -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.