fix slice index underrun
This commit is contained in:
parent
73a020b239
commit
05ab3c9ed1
4
main.go
4
main.go
@ -194,8 +194,8 @@ func menuHandler(ctx context.Context, conn net.Conn, w *gaio.Watcher) {
|
|||||||
}
|
}
|
||||||
if res.Operation == gaio.OpRead && res.Size > 0 && res.Conn == conn {
|
if res.Operation == gaio.OpRead && res.Size > 0 && res.Conn == conn {
|
||||||
log.Printf("received on inChan: conn: %v, buffer size: %v\n", res.Conn.RemoteAddr(), res.Size)
|
log.Printf("received on inChan: conn: %v, buffer size: %v\n", res.Conn.RemoteAddr(), res.Size)
|
||||||
log.Println("menu receive: ", strings.TrimSpace(string(res.Buffer[:res.Size-2])))
|
log.Println("menu receive: ", strings.TrimSpace(string(res.Buffer[:res.Size-1])))
|
||||||
switch string(strings.TrimSpace(string(res.Buffer[:res.Size-2]))) {
|
switch string(strings.TrimSpace(string(res.Buffer[:res.Size-1]))) {
|
||||||
|
|
||||||
case "welcome":
|
case "welcome":
|
||||||
welcomeStr, err := screenHandler("welcome", nil)
|
welcomeStr, err := screenHandler("welcome", nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user