aboutsummaryrefslogtreecommitdiff
path: root/query.go
diff options
context:
space:
mode:
authorfusion32 <marcopuzziello@gmail.com>2026-06-20 22:08:57 -0300
committerfusion32 <marcopuzziello@gmail.com>2026-06-20 22:08:57 -0300
commitc61e2918e52e929722e5bd97ddaa1747d7ed1744 (patch)
tree65030dd4639d28556d4d8383602f88ebb84d64e4 /query.go
parent48375acd7d6581b42b354618ed694a9d1cd25439 (diff)
downloadweb-c61e2918e52e929722e5bd97ddaa1747d7ed1744.tar.gz
web-c61e2918e52e929722e5bd97ddaa1747d7ed1744.zip
minor cleanupHEADmaster
Diffstat (limited to 'query.go')
-rw-r--r--query.go21
1 files changed, 11 insertions, 10 deletions
diff --git a/query.go b/query.go
index 3abca9a..70fac5a 100644
--- a/query.go
+++ b/query.go
@@ -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