fix key scan err handling

main
Nikita Tokarchuk 5 years ago
parent 86eceeeba5
commit 8efa577e41
  1. 12
      task3-backend/lib/server.go

@ -165,19 +165,17 @@ func (s *Server) readKey(conn net.Conn) (key string, err error) {
scanner.Buffer(buf, 0) scanner.Buffer(buf, 0)
for { ok := scanner.Scan()
err = scanner.Err() err = scanner.Err()
if err != nil { if err != nil {
return log.Debugf("cannot scan, %v", err)
} }
if !ok {
if !scanner.Scan() { return
continue
} }
key = scanner.Text() key = scanner.Text()
break
}
return return
} }

Loading…
Cancel
Save