aboutsummaryrefslogtreecommitdiff
path: root/workerpool.go
diff options
context:
space:
mode:
authorGravatar Aliaksandr Valialkin <valyala@gmail.com> 2015-11-23 12:57:37 +0200
committerGravatar Aliaksandr Valialkin <valyala@gmail.com> 2015-11-23 12:57:37 +0200
commit76f453b7fc17553c6688692eaa3432d94cdb3e3e (patch)
treebcad864595a61d69fced871632cbab28328f22f4 /workerpool.go
parentRandomize sleep time in Client.DoTimeout when waiting for free connection to ... (diff)
downloadfasthttp-76f453b7fc17553c6688692eaa3432d94cdb3e3e.tar.gz
fasthttp-76f453b7fc17553c6688692eaa3432d94cdb3e3e.tar.bz2
fasthttp-76f453b7fc17553c6688692eaa3432d94cdb3e3e.zip
Suppress too chatty 'broken pipe' errors when serving clients, which unexpectedly close connections
Diffstat (limited to 'workerpool.go')
-rw-r--r--workerpool.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/workerpool.go b/workerpool.go
index 34a846e..727793b 100644
--- a/workerpool.go
+++ b/workerpool.go
@@ -3,6 +3,7 @@ package fasthttp
import (
"net"
"runtime/debug"
+ "strings"
"sync"
"time"
)
@@ -161,7 +162,7 @@ func (wp *workerPool) workerFunc(ch *workerChan) {
if c == nil {
break
}
- if err = wp.WorkerFunc(c); err != nil {
+ if err = wp.WorkerFunc(c); err != nil && !strings.Contains(err.Error(), "broken pipe") {
wp.Logger.Printf("error when serving connection %q<->%q: %s", c.LocalAddr(), c.RemoteAddr(), err)
}
c.Close()