Skip to content

Commit

Permalink
remove bug of reading previous messages
Browse files Browse the repository at this point in the history
  • Loading branch information
c-f committed Dec 20, 2021
1 parent 8d698e9 commit 4fb2abb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/tcpserver/tcpserver.go
Expand Up @@ -59,14 +59,14 @@ func (t *TCPServer) handleConnection(conn net.Conn) error {
if err := conn.SetReadDeadline(time.Now().Add(readTimeout * time.Second)); err != nil {
gologger.Info().Msgf("%s\n", err)
}
_, err := conn.Read(buf)
n, err := conn.Read(buf)
if err != nil {
return err
}

gologger.Print().Msgf("%s\n", buf)
gologger.Print().Msgf("%s\n", buf[:n])

resp, err := t.BuildResponse(buf)
resp, err := t.BuildResponse(buf[:n])
if err != nil {
return err
}
Expand Down

0 comments on commit 4fb2abb

Please sign in to comment.