diff options
author | Valery Piashchynski <[email protected]> | 2021-01-23 20:08:44 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-01-23 20:08:44 +0300 |
commit | 2be3d45300e3e8b437953f180fa8c54a0331e6cd (patch) | |
tree | 153415728b707b7d10298e01e04192a63e7c7733 /utils | |
parent | 2b12bc942f9eeb0b75325cc69a296076535f391a (diff) |
Fix windows network package
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/network.go | 8 | ||||
-rwxr-xr-x | utils/network_windows.go | 10 |
2 files changed, 9 insertions, 9 deletions
diff --git a/utils/network.go b/utils/network.go index c9db0e68..e57854a8 100755 --- a/utils/network.go +++ b/utils/network.go @@ -12,6 +12,14 @@ import ( "github.com/valyala/tcplisten" ) +// - SO_REUSEPORT. This option allows linear scaling server performance +// on multi-CPU servers. +// See https://www.nginx.com/blog/socket-sharding-nginx-release-1-9-1/ for details. +// +// - TCP_DEFER_ACCEPT. This option expects the server reads from the accepted +// connection before writing to them. +// +// - TCP_FASTOPEN. See https://lwn.net/Articles/508865/ for details. // CreateListener crates socket listener based on DSN definition. func CreateListener(address string) (net.Listener, error) { dsn := strings.Split(address, "://") diff --git a/utils/network_windows.go b/utils/network_windows.go index a07ac351..6eefb8f7 100755 --- a/utils/network_windows.go +++ b/utils/network_windows.go @@ -8,8 +8,6 @@ import ( "os" "strings" "syscall" - - "github.com/valyala/tcplisten" ) // CreateListener crates socket listener based on DSN definition. @@ -47,13 +45,7 @@ func CreateListener(address string) (net.Listener, error) { } func createTCPListener(addr string) (net.Listener, error) { - cfg := tcplisten.Config{ - ReusePort: true, - DeferAccept: true, - FastOpen: true, - Backlog: 0, - } - listener, err := cfg.NewListener("tcp4", addr) + listener, err := net.Listen("tcp", addr) if err != nil { return nil, err } |