From 4e6cca530b19371f5dbe803a75e6274f0ff13528 Mon Sep 17 00:00:00 2001 From: pztrn Date: Tue, 4 Oct 2016 18:38:58 +0500 Subject: [PATCH] Fix segfault on macOS when port wasn't properly parsed. --- requester/requester_object.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/requester/requester_object.go b/requester/requester_object.go index b36faeb..d844c43 100644 --- a/requester/requester_object.go +++ b/requester/requester_object.go @@ -12,6 +12,7 @@ package requester import ( // stdlib "bytes" + "errors" "fmt" "net" "strconv" @@ -169,7 +170,7 @@ func (r *Requester) updateServerGoroutineDispatcher(data [][]string) map[string] } // Updates information about specific server. -func (r *Requester) UpdateServer(server *datamodels.Server) { +func (r *Requester) UpdateServer(server *datamodels.Server) error { srv := server.Ip + ":" + server.Port fmt.Println("Updating server: " + srv) @@ -177,6 +178,7 @@ func (r *Requester) UpdateServer(server *datamodels.Server) { conn, err1 := net.Dial("udp", srv) if err1 != nil { fmt.Println("Error dialing to server " + srv + "!") + return errors.New("Error dialing to server " + srv + "!") } defer conn.Close() @@ -233,4 +235,6 @@ func (r *Requester) UpdateServer(server *datamodels.Server) { // ToDo: Calculate ping. 0 for now. server.Ping = "0" + + return nil }