diff options
Diffstat (limited to 'query.go')
| -rw-r--r-- | query.go | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -2,6 +2,7 @@ package main import ( "encoding/binary" + "io" "net" "strings" "sync" @@ -41,14 +42,14 @@ const ( type ( TWorld struct { - Name string - Type string - NumPlayers int - MaxPlayers int - OnlinePeak int + Name string + Type string + NumPlayers int + MaxPlayers int + OnlinePeak int OnlinePeakTimestamp int - LastStartup int - LastShutdown int + LastStartup int + LastShutdown int } TAccountSummary struct { @@ -214,7 +215,7 @@ func (Connection *TQueryManagerConnection) ExecuteQuery(AutoReconnect bool, Writ } var Help [4]byte - if _, Err := Connection.Handle.Read(Help[:2]); Err != nil { + if _, Err := io.ReadFull(Connection.Handle, Help[:2]); Err != nil { Connection.Disconnect() if Attempt >= MaxAttempts { g_LogErr.Printf("Failed to read response size: %v", Err) @@ -225,7 +226,7 @@ func (Connection *TQueryManagerConnection) ExecuteQuery(AutoReconnect bool, Writ ResponseSize := int(binary.LittleEndian.Uint16(Help[:2])) if ResponseSize == 0xFFFF { - if _, Err := Connection.Handle.Read(Help[:]); Err != nil { + if _, Err := io.ReadFull(Connection.Handle, Help[:]); Err != nil { Connection.Disconnect() g_LogErr.Printf("Failed to read response extended size: %v", Err) return @@ -241,7 +242,7 @@ func (Connection *TQueryManagerConnection) ExecuteQuery(AutoReconnect bool, Writ return } - if _, Err := Connection.Handle.Read(Buffer[:ResponseSize]); Err != nil { + if _, Err := io.ReadFull(Connection.Handle, Buffer[:ResponseSize]); Err != nil { Connection.Disconnect() g_LogErr.Printf("Failed to read response: %v", Err) return |
