Skip to content

Commit 837631f

Browse files
author
anahan
committed
Fix infinity loop DataListener.handleConnection
1 parent c426214 commit 837631f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

internal/applog/data_listener.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,19 @@ func (l *DataListener) handleConnection(conn net.Conn) {
4747

4848
for {
4949
buf, err := line.ReadOne(reader, true)
50-
if err != nil {
51-
if err != io.EOF {
52-
l.errorChan <- err
53-
}
54-
55-
break
50+
if len(buf) > 0 {
51+
_, _ = l.writer.Write(l.normalizeLine(buf))
5652
}
5753

58-
if len(buf) == 0 {
54+
if err == nil {
5955
continue
6056
}
6157

62-
_, _ = l.writer.Write(l.normalizeLine(buf))
58+
if err != io.EOF {
59+
l.errorChan <- err
60+
}
61+
62+
break
6363
}
6464
}
6565

0 commit comments

Comments
 (0)