remove zero downtime for windows.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu
2016-12-14 00:08:36 +08:00
parent 5b23e79800
commit c5bba12d76
5 changed files with 43 additions and 18 deletions

View File

@@ -2,7 +2,6 @@ package gorush
import (
"fmt"
"github.com/appleboy/endless"
"github.com/gin-gonic/gin"
api "gopkg.in/appleboy/gin-status-api.v1"
"net/http"
@@ -81,15 +80,3 @@ func routerEngine() *gin.Engine {
return r
}
// RunHTTPServer provide run http or https protocol.
func RunHTTPServer() error {
var err error
if PushConf.Core.SSL && PushConf.Core.CertPath != "" && PushConf.Core.KeyPath != "" {
err = endless.ListenAndServeTLS(":"+PushConf.Core.Port, PushConf.Core.CertPath, PushConf.Core.KeyPath, routerEngine())
} else {
err = endless.ListenAndServe(":"+PushConf.Core.Port, routerEngine())
}
return err
}

20
gorush/server_unix.go Normal file
View File

@@ -0,0 +1,20 @@
// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris
package gorush
import (
"github.com/fvbock/endless"
)
// RunHTTPServer provide run http or https protocol.
func RunHTTPServer() error {
var err error
if PushConf.Core.SSL && PushConf.Core.CertPath != "" && PushConf.Core.KeyPath != "" {
err = endless.ListenAndServeTLS(":"+PushConf.Core.Port, PushConf.Core.CertPath, PushConf.Core.KeyPath, routerEngine())
} else {
err = endless.ListenAndServe(":"+PushConf.Core.Port, routerEngine())
}
return err
}

18
gorush/server_windows.go Normal file
View File

@@ -0,0 +1,18 @@
package gorush
import (
"net/http"
)
// RunHTTPServer provide run http or https protocol.
func RunHTTPServer() error {
var err error
if PushConf.Core.SSL && PushConf.Core.CertPath != "" && PushConf.Core.KeyPath != "" {
err = http.ListenAndServeTLS(":"+PushConf.Core.Port, PushConf.Core.CertPath, PushConf.Core.KeyPath, routerEngine())
} else {
err = http.ListenAndServe(":"+PushConf.Core.Port, routerEngine())
}
return err
}