Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
add: disconnection reason
Browse files Browse the repository at this point in the history
  • Loading branch information
ggmolly committed Jun 15, 2024
1 parent f8548f4 commit 9e01b75
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions consts/disconnect_reasons.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package consts

import "fmt"

const (
DR_LOGGED_IN_ON_ANOTHER_DEVICE = 1
DR_SERVER_MAINTENANCE = 2
DR_GAME_UPDATE = 3
DR_OFFLINE_TOO_LONG = 4
DR_CONNECTION_LOST = 5
DR_CONNECTION_TO_SERVER_LOST = 6
DR_DATA_VALIDATION_FAILED = 7
DR_LOGIN_DATA_EXPIRED = 199
)

func ResolveReason(reason uint8) string {
switch reason {
case DR_LOGGED_IN_ON_ANOTHER_DEVICE:
return "logged in on another device"
case DR_SERVER_MAINTENANCE:
return "server maintenance"
case DR_GAME_UPDATE:
return "game update"
case DR_OFFLINE_TOO_LONG:
return "offline too long"
case DR_CONNECTION_LOST:
return "connection lost"
case DR_CONNECTION_TO_SERVER_LOST:
return "connection to server lost"
case DR_DATA_VALIDATION_FAILED:
return "data validation failed"
case DR_LOGIN_DATA_EXPIRED:
return "login data expired"
default:
return fmt.Sprintf("unknown reason %d", reason)
}
}

0 comments on commit 9e01b75

Please sign in to comment.