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)