File tree Expand file tree Collapse file tree 3 files changed +36
-21
lines changed Expand file tree Collapse file tree 3 files changed +36
-21
lines changed Original file line number Diff line number Diff line change @@ -4,34 +4,13 @@ import (
44 "fmt"
55 "gin-vue-admin/global"
66 "gin-vue-admin/initialize"
7- "github.com/fvbock/endless"
8- "github.com/gin-gonic/gin"
9- "net/http"
10- "runtime"
117 "time"
128)
139
1410type server interface {
1511 ListenAndServe () error
1612}
1713
18- func initServer (address string , router * gin.Engine ) server {
19- if runtime .GOOS == "windows" {
20- return & http.Server {
21- Addr : address ,
22- Handler : router ,
23- ReadTimeout : 10 * time .Second ,
24- WriteTimeout : 10 * time .Second ,
25- MaxHeaderBytes : 1 << 20 ,
26- }
27- }
28- s := endless .NewServer (address , router )
29- s .ReadHeaderTimeout = 10 * time .Millisecond
30- s .WriteTimeout = 10 * time .Second
31- s .MaxHeaderBytes = 1 << 20
32- return s
33- }
34-
3514func RunWindowsServer () {
3615 if global .GVA_CONFIG .System .UseMultipoint {
3716 // 初始化redis服务
Original file line number Diff line number Diff line change 1+ // +build !windows
2+
3+ package core
4+
5+ import (
6+ "github.com/fvbock/endless"
7+ "github.com/gin-gonic/gin"
8+ "time"
9+ )
10+
11+ func initServer (address string , router * gin.Engine ) server {
12+ s := endless .NewServer (address , router )
13+ s .ReadHeaderTimeout = 10 * time .Millisecond
14+ s .WriteTimeout = 10 * time .Second
15+ s .MaxHeaderBytes = 1 << 20
16+ return s
17+ }
Original file line number Diff line number Diff line change 1+ // +build windows
2+
3+ package core
4+
5+ import (
6+ "github.com/gin-gonic/gin"
7+ "net/http"
8+ "time"
9+ )
10+
11+ func initServer (address string , router * gin.Engine ) server {
12+ return & http.Server {
13+ Addr : address ,
14+ Handler : router ,
15+ ReadTimeout : 10 * time .Second ,
16+ WriteTimeout : 10 * time .Second ,
17+ MaxHeaderBytes : 1 << 20 ,
18+ }
19+ }
You can’t perform that action at this time.
0 commit comments