mirror of
https://github.com/WiiLink24/wfc-server.git
synced 2026-07-31 07:26:56 -05:00
[GPSP] Prevent invalid messages from stopping the server
This commit is contained in:
parent
19fa39bfff
commit
322460625c
|
|
@ -13,7 +13,7 @@ type GameSpyCommand struct {
|
|||
}
|
||||
|
||||
var (
|
||||
InvalidGameSpyCommand = errors.New("invalid command received")
|
||||
InvalidGameSpyCommand = errors.New("Invalid command received")
|
||||
)
|
||||
|
||||
func ParseGameSpyMessage(msg string) ([]GameSpyCommand, error) {
|
||||
|
|
|
|||
12
gpsp/main.go
12
gpsp/main.go
|
|
@ -91,7 +91,8 @@ func handleRequest(conn net.Conn) {
|
|||
|
||||
commands, err := common.ParseGameSpyMessage(string(buffer))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
logging.Error(moduleName, err)
|
||||
return
|
||||
}
|
||||
|
||||
for _, command := range commands {
|
||||
|
|
@ -110,7 +111,8 @@ func handleRequest(conn net.Conn) {
|
|||
|
||||
profileId, err := strconv.ParseUint(strProfileId, 10, 32)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
logging.Error(moduleName, err)
|
||||
return
|
||||
}
|
||||
|
||||
if knownProfileId == 0 {
|
||||
|
|
@ -158,7 +160,8 @@ func handleOthersList(moduleName string, profileId uint32, command common.GameSp
|
|||
|
||||
numOpidsValue, err := strconv.Atoi(numopids)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
logging.Error(moduleName, err)
|
||||
return empty
|
||||
}
|
||||
|
||||
opidsSplit := []string{}
|
||||
|
|
@ -177,7 +180,8 @@ func handleOthersList(moduleName string, profileId uint32, command common.GameSp
|
|||
for _, strOtherId := range opidsSplit {
|
||||
otherId, err := strconv.ParseUint(strOtherId, 10, 32)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
logging.Error(moduleName, err)
|
||||
continue
|
||||
}
|
||||
|
||||
// TODO: Perhaps this could be condensed into one database query
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user