This commit is contained in:
wjqserver 2025-06-15 15:14:15 +08:00
parent cf5ae0d184
commit fd7e270db4
10 changed files with 56 additions and 21 deletions

12
main.go
View file

@ -431,6 +431,7 @@ func main() {
server.WithHostPorts(addr),
server.WithTransport(standard.NewTransporter),
server.WithStreamBody(true),
server.WithIdleTimeout(30*time.Second),
)
r.AddProtocol("h2", factory.NewServerFactory())
} else {
@ -438,6 +439,7 @@ func main() {
server.WithHostPorts(addr),
server.WithTransport(standard.NewTransporter),
server.WithStreamBody(true),
server.WithIdleTimeout(30*time.Second),
)
}
} else if cfg.Server.NetLib == "netpoll" || cfg.Server.NetLib == "" {
@ -447,6 +449,7 @@ func main() {
server.WithHostPorts(addr),
server.WithSenseClientDisconnection(cfg.Server.SenseClientDisconnection),
server.WithStreamBody(true),
server.WithIdleTimeout(30*time.Second),
)
r.AddProtocol("h2", factory.NewServerFactory())
} else {
@ -454,6 +457,7 @@ func main() {
server.WithHostPorts(addr),
server.WithSenseClientDisconnection(cfg.Server.SenseClientDisconnection),
server.WithStreamBody(true),
server.WithIdleTimeout(30*time.Second),
)
}
} else {
@ -462,6 +466,14 @@ func main() {
os.Exit(1)
}
/*
if cfg.Server.GoPoolSize > 0 {
gopool.SetCap(int32(cfg.Server.GoPoolSize))
} else {
gopool.SetCap(1024)
}
*/
r.Use(recovery.Recovery()) // Recovery中间件
r.Use(loggin.Middleware()) // log中间件
r.Use(viaHeader())