Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 13, 01:45 UTC
core: Use SO_REUSEPORT_LB on FreeBSD (#5554)
to balance load between threads.
Jonathan Davies committed
May 23, 2023 at 17:56 UTC
942fbb37ec46f1907e57a04c44ca790bd47ed52c
3 files changed
+15
-1
listen_unix.go
+1
-1
@@ -119,7 +119,7 @@ func reusePort(network, address string, conn syscall.RawConn) error {
119
return nil
120
}
121
return conn.Control(func(descriptor uintptr) {
122
- if err := unix.SetsockoptInt(int(descriptor), unix.SOL_SOCKET, unix.SO_REUSEPORT, 1); err != nil {
122
+ if err := unix.SetsockoptInt(int(descriptor), unix.SOL_SOCKET, unixSOREUSEPORT, 1); err != nil {
123
Log().Error("setting SO_REUSEPORT",
124
zap.String("network", network),
125
zap.String("address", address),
listen_unix_setopt.go
new
+7
@@ -0,0 +1,7 @@
1
+//go:build unix && !freebsd
2
+
3
+package caddy
4
+
5
+import "golang.org/x/sys/unix"
6
+
7
+const unixSOREUSEPORT = unix.SO_REUSEPORT
listen_unix_setopt_freebsd.go
new
+7
@@ -0,0 +1,7 @@
1
+//go:build freebsd
2
+
3
+package caddy
4
+
5
+import "golang.org/x/sys/unix"
6
+
7
+const unixSOREUSEPORT = unix.SO_REUSEPORT_LB