aboutsummaryrefslogtreecommitdiff
path: root/workerpool.go
diff options
context:
space:
mode:
authorGravatar 徐乔伦 <Jamesxql@Gmail.com> 2018-08-30 16:17:40 +0800
committerGravatar Kirill Danshin <kirill@danshin.pro> 2018-08-30 15:20:32 +0000
commit69613e6feb71e1b1a3379c7f70cf16cb92d44dea (patch)
treede0cc83dbdeccdb7c0faec6c79c8cdbe0633d0e1 /workerpool.go
parentTry the same formats as net/http for cookie expire (diff)
downloadfasthttp-69613e6feb71e1b1a3379c7f70cf16cb92d44dea.tar.gz
fasthttp-69613e6feb71e1b1a3379c7f70cf16cb92d44dea.tar.bz2
fasthttp-69613e6feb71e1b1a3379c7f70cf16cb92d44dea.zip
add support for http.ConnState
issue #205
Diffstat (limited to 'workerpool.go')
-rw-r--r--workerpool.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/workerpool.go b/workerpool.go
index 6ce2778..0e44a27 100644
--- a/workerpool.go
+++ b/workerpool.go
@@ -2,6 +2,7 @@ package fasthttp
import (
"net"
+ "net/http"
"runtime"
"strings"
"sync"
@@ -35,6 +36,8 @@ type workerPool struct {
stopCh chan struct{}
workerChanPool sync.Pool
+
+ connState func(net.Conn, http.ConnState)
}
type workerChan struct {
@@ -216,8 +219,11 @@ func (wp *workerPool) workerFunc(ch *workerChan) {
wp.Logger.Printf("error when serving connection %q<->%q: %s", c.LocalAddr(), c.RemoteAddr(), err)
}
}
- if err != errHijacked {
+ if err == errHijacked {
+ wp.connState(c, http.StateHijacked)
+ } else {
c.Close()
+ wp.connState(c, http.StateClosed)
}
c = nil