minor cleanup
This commit is contained in:
parent
48375acd7d
commit
c61e2918e5
21
query.go
21
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
|
||||
|
||||
11
session.go
11
session.go
@ -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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user