From d68f342040f0d3d6e983253f3f557c0dccc7d09e Mon Sep 17 00:00:00 2001 From: Jordan Orelli Date: Sat, 8 Nov 2014 17:13:58 -0500 Subject: [PATCH] maybe don't flail when games end --- main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.go b/main.go index aaf2cbb..94508b2 100644 --- a/main.go +++ b/main.go @@ -49,6 +49,7 @@ func handleConnection(conn *Connection) { } else { fmt.Fprintf(conn, "you are in the system %s. There are %d planets here.\n", system.name, system.planets) } +READING: for { line, err := conn.ReadString('\n') switch err { @@ -58,6 +59,8 @@ func handleConnection(conn *Connection) { break default: log_error("failed to read line from player %s: %v", conn.PlayerName(), err) + time.Sleep(time.Second) + continue READING } line = strings.TrimSpace(line)