diff options
| author | fusion32 <marcopuzziello@gmail.com> | 2026-06-20 22:08:57 -0300 |
|---|---|---|
| committer | fusion32 <marcopuzziello@gmail.com> | 2026-06-20 22:08:57 -0300 |
| commit | c61e2918e52e929722e5bd97ddaa1747d7ed1744 (patch) | |
| tree | 65030dd4639d28556d4d8383602f88ebb84d64e4 | |
| parent | 48375acd7d6581b42b354618ed694a9d1cd25439 (diff) | |
| download | web-c61e2918e52e929722e5bd97ddaa1747d7ed1744.tar.gz web-c61e2918e52e929722e5bd97ddaa1747d7ed1744.zip | |
| -rw-r--r-- | query.go | 21 | ||||
| -rw-r--r-- | session.go | 11 |
2 files changed, 11 insertions, 21 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 @@ -27,17 +27,6 @@ var ( g_Sessions []TSession ) -func GenerateSessionID() []byte { - var SessionID [32]byte - _, Err := rand.Read(SessionID[:]) - if Err != nil { - g_LogErr.Printf("Failed to generate session id: %v", Err) - return nil - } - - return SessionID[:] -} - func GetRequestSessionID(Request *http.Request) []byte { Cookie, Err := Request.Cookie("GOSESSID") if Err != nil { |
