aboutsummaryrefslogtreecommitdiff
path: root/reuseport
diff options
context:
space:
mode:
authorGravatar Aliaksandr Valialkin <valyala@gmail.com> 2015-11-28 09:26:18 +0200
committerGravatar Aliaksandr Valialkin <valyala@gmail.com> 2015-11-28 09:26:18 +0200
commita0cc899f648c27d03a01df55ccf6a7c5a9926f7f (patch)
tree9d30e094b723fbe411bc43213868240c730a1eea /reuseport
parentUse deferred accept in reuseport.Listener. This should reduce the number of c... (diff)
downloadfasthttp-a0cc899f648c27d03a01df55ccf6a7c5a9926f7f.tar.gz
fasthttp-a0cc899f648c27d03a01df55ccf6a7c5a9926f7f.tar.bz2
fasthttp-a0cc899f648c27d03a01df55ccf6a7c5a9926f7f.zip
Removed TCP_DEFER_ACCEPT from reuseport listening socket, since it has no measurable performance wins, but has a drawback that the established connection lifetime cannot be controlled by user program until the client sends initial request
Diffstat (limited to 'reuseport')
-rw-r--r--reuseport/reuseport.go5
-rw-r--r--reuseport/reuseport_bsd.go6
-rw-r--r--reuseport/reuseport_linux.go8
3 files changed, 0 insertions, 19 deletions
diff --git a/reuseport/reuseport.go b/reuseport/reuseport.go
index 69d861a..ee33f7d 100644
--- a/reuseport/reuseport.go
+++ b/reuseport/reuseport.go
@@ -72,11 +72,6 @@ func Listen(network, addr string) (l net.Listener, err error) {
return nil, &ErrNoReusePort{err}
}
- if err = setTCPDeferAccept(fd); err != nil {
- syscall.Close(fd)
- return nil, err
- }
-
if err = syscall.Bind(fd, sockaddr); err != nil {
syscall.Close(fd)
return nil, err
diff --git a/reuseport/reuseport_bsd.go b/reuseport/reuseport_bsd.go
index f9cca96..4cd7811 100644
--- a/reuseport/reuseport_bsd.go
+++ b/reuseport/reuseport_bsd.go
@@ -3,9 +3,3 @@
package reuseport
var reusePort = syscall.SO_REUSEPORT
-
-func setTCPDeferAccept(fd int) error {
- // BSD supports similar SO_ACCEPTFILTER option, but I have no access
- // to BSD at the moment for proper implementation.
- return nil
-}
diff --git a/reuseport/reuseport_linux.go b/reuseport/reuseport_linux.go
index c7f31db..1c417c8 100644
--- a/reuseport/reuseport_linux.go
+++ b/reuseport/reuseport_linux.go
@@ -2,12 +2,4 @@
package reuseport
-import (
- "syscall"
-)
-
var reusePort = 0x0F
-
-func setTCPDeferAccept(fd int) error {
- return syscall.SetsockoptInt(fd, syscall.SOL_SOCKET, syscall.TCP_DEFER_ACCEPT, 2)
-}