提交 63f2886d 编写于 作者: 徐志伟

修复Windows下编译endless失败问题

上级 90f53375
......@@ -4,10 +4,6 @@ import (
"fmt"
"gin-vue-admin/global"
"gin-vue-admin/initialize"
"github.com/fvbock/endless"
"github.com/gin-gonic/gin"
"net/http"
"runtime"
"time"
)
......@@ -15,23 +11,6 @@ type server interface {
ListenAndServe() error
}
func initServer(address string, router *gin.Engine) server {
if runtime.GOOS == "windows" {
return &http.Server{
Addr: address,
Handler: router,
ReadTimeout: 10 * time.Second,
WriteTimeout: 10 * time.Second,
MaxHeaderBytes: 1 << 20,
}
}
s := endless.NewServer(address, router)
s.ReadHeaderTimeout = 10 * time.Millisecond
s.WriteTimeout = 10 * time.Second
s.MaxHeaderBytes = 1 << 20
return s
}
func RunWindowsServer() {
if global.GVA_CONFIG.System.UseMultipoint {
// 初始化redis服务
......
// +build !windows
package core
import (
"github.com/fvbock/endless"
"github.com/gin-gonic/gin"
"time"
)
func initServer(address string, router *gin.Engine) server {
s := endless.NewServer(address, router)
s.ReadHeaderTimeout = 10 * time.Millisecond
s.WriteTimeout = 10 * time.Second
s.MaxHeaderBytes = 1 << 20
return s
}
\ No newline at end of file
// +build windows
package core
import (
"github.com/gin-gonic/gin"
"net/http"
"time"
)
func initServer(address string, router *gin.Engine) server {
return &http.Server{
Addr: address,
Handler: router,
ReadTimeout: 10 * time.Second,
WriteTimeout: 10 * time.Second,
MaxHeaderBytes: 1 << 20,
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册