mirror of
https://github.com/mainnika/a-quest.git
synced 2026-07-03 17:42:33 +00:00
fix key scan err handling
This commit is contained in:
@@ -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 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if !scanner.Scan() {
|
if err != nil {
|
||||||
continue
|
log.Debugf("cannot scan, %v", err)
|
||||||
}
|
|
||||||
|
|
||||||
key = scanner.Text()
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
key = scanner.Text()
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user