You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f27f15e
Browse filesBrowse the repository at this point in the historyBrowse files
Robert Bailey
authored
Update the simple game server to move itself back to the Ready state (agones-dev#2409)
after allocation.
This allows us to test the "Reusing Allocated GameServers" integration
pattern.
Copy file name to clipboardExpand all lines: examples/simple-game-server/main.go
+54-23Lines changed: 54 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,8 @@ func main() {
41
41
readyOnStart:=flag.Bool("ready", true, "Mark this GameServer as Ready on startup")
42
42
shutdownDelayMin:=flag.Int("automaticShutdownDelayMin", 0, "[Deprecated] If greater than zero, automatically shut down the server this many minutes after the server becomes allocated (please use automaticShutdownDelaySec instead)")
43
43
shutdownDelaySec:=flag.Int("automaticShutdownDelaySec", 0, "If greater than zero, automatically shut down the server this many seconds after the server becomes allocated (cannot be used if automaticShutdownDelayMin is set)")
44
-
readyDelaySec:=flag.Int("readyDelaySec", 0, "If greater than zero and readyOnStart is true, wait this many seconds before marking the game server as ready")
44
+
readyDelaySec:=flag.Int("readyDelaySec", 0, "If greater than zero, wait this many seconds each time before marking the game server as ready")
45
+
readyIterations:=flag.Int("readyIterations", 0, "If greater than zero, return to a ready state this number of times before shutting down")
45
46
udp:=flag.Bool("udp", true, "Server will listen on UDP")
46
47
tcp:=flag.Bool("tcp", false, "Server will listen on TCP")
47
48
@@ -66,8 +67,12 @@ func main() {
66
67
tcp=&t
67
68
}
68
69
69
-
if!*udp&&!*tcp {
70
-
log.Fatalf("No protocol enabled, exiting")
70
+
// Check for incompatible flags.
71
+
if*shutdownDelayMin>0&&*shutdownDelaySec>0 {
72
+
log.Fatalf("Cannot set both --automaticShutdownDelayMin and --automaticShutdownDelaySec")
0 commit comments