-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate valyala/tcplisten to this repo #1926 #1929
base: master
Are you sure you want to change the base?
Conversation
…CP backlog size update of uint16->uint32 with Linux
…rt for dual-stack socket
…oroutine as the test
700e617
to
75a611b
Compare
I think the error is caused by |
@ksw2000 Can these be added too? |
About implementation of the keepalive feature: When calling However, there is an alternative method to set keepAlive after calling func main() {
cfg := tcplisten.Config{
ReusePort: true,
}
ln, err := cfg.NewListener("tcp", "0.0.0.0:8082")
if err != nil {
panic(err)
}
for {
conn, err := ln.Accept()
if err != nil {
panic(err)
}
if conn, ok := conn.(*net.TCPConn); ok {
conn.SetKeepAlive(true)
conn.SetKeepAlivePeriod(time.Second)
}
go func() {
defer conn.Close()
fmt.Println("Accepted connection from", conn.RemoteAddr())
}()
}
} Of course, if we still want to add the keepAlive feature, we could also wrap the |
@ksw2000 Agree, it does sound confusing. |
Resolve #1926
This PR moves the valyala/tcplisten package to fasthttp and also migrates PR#6 and PR#10 together. Additionally, it upgrades the deprecated
ioutil
package and replaces the+build
directive withgo:build
. Furthermore, it fixes the warning intcplisten_test.go
regarding "the goroutine calls T.Fatalf, which must be called in the same goroutine as the test".