fix key scan err handling

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

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

Loading…
Cancel
Save