Dont log errors if client closes connections.

This commit is contained in:
Sascha L. Teichmann 2014-08-04 15:18:32 +02:00
parent 7a98421645
commit 61cc35fda8
2 changed files with 5 additions and 1 deletions

View File

@ -39,6 +39,7 @@ func (c *Connection) Run() {
r := bufio.NewReader(c.conn)
parser := NewRedisParser(r, rce)
parser.Parse()
log.Println("client disconnected")
}
func logError(err error) {

View File

@ -8,6 +8,7 @@ import (
"bufio"
"bytes"
"fmt"
"io"
"log"
"strconv"
)
@ -39,7 +40,9 @@ func (rp *RedisParser) Parse() {
func (rp *RedisParser) nextLine() []byte {
line, err := rp.reader.ReadBytes('\n')
if err != nil {
rp.consumer.ConsumeError(err)
if err != io.EOF {
rp.consumer.ConsumeError(err)
}
return nil
}
return bytes.TrimRight(line, "\r\n")