tiny bug fix

This commit is contained in:
hdt3213
2020-12-12 22:08:04 +08:00
parent cc6475f6a8
commit bf21b9f280
2 changed files with 2 additions and 2 deletions

View File

@@ -55,7 +55,7 @@ func (h *EchoHandler)Handle(ctx context.Context, conn net.Conn) {
if err != nil {
if err == io.EOF {
logger.Info("connection close")
h.activeConn.Delete(conn)
h.activeConn.Delete(client)
} else {
logger.Warn(err)
}

View File

@@ -68,11 +68,11 @@ func ListenAndServe(cfg *Config, handler tcp.Handler) {
}
// handle
logger.Info("accept link")
waitDone.Add(1)
go func() {
defer func() {
waitDone.Done()
}()
waitDone.Add(1)
handler.Handle(ctx, conn)
}()
}