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

8
glide.lock generated
View File

@ -1,8 +1,6 @@
hash: f556af81603ead677d8a4395b7a30b82956364273348e8c90f53c0cd0f6b4809 hash: cccd36b5dd331f04f363476ebc21becfa3650945e3fd0b41821871702bc04743
updated: 2016-12-13T21:51:55.200004656+08:00 updated: 2016-12-14T00:05:23.060124146+08:00
imports: imports:
- name: github.com/appleboy/endless
version: d773d36255895bc52adcfe318727f5e30f401b8e
- name: github.com/asdine/storm - name: github.com/asdine/storm
version: 00b2f2df7ab7af9db746b826649395628cb5374e version: 00b2f2df7ab7af9db746b826649395628cb5374e
subpackages: subpackages:
@ -11,6 +9,8 @@ imports:
- index - index
- name: github.com/boltdb/bolt - name: github.com/boltdb/bolt
version: acc803f0ced151102ed51bf824f8709ebd6602bc version: acc803f0ced151102ed51bf824f8709ebd6602bc
- name: github.com/fvbock/endless
version: 2cdc20a776897c0f406853c048c33e2c1a9f0ebf
- name: github.com/gin-gonic/gin - name: github.com/gin-gonic/gin
version: f931d1ea80ae95a6fc739213cdd9399bd2967fb6 version: f931d1ea80ae95a6fc739213cdd9399bd2967fb6
subpackages: subpackages:

View File

@ -1,8 +1,8 @@
package: github.com/appleboy/gorush package: github.com/appleboy/gorush
import: import:
- package: github.com/Sirupsen/logrus - package: github.com/Sirupsen/logrus
- package: github.com/appleboy/endless
- package: github.com/asdine/storm - package: github.com/asdine/storm
- package: github.com/fvbock/endless
- package: github.com/gin-gonic/gin - package: github.com/gin-gonic/gin
- package: github.com/google/go-gcm - package: github.com/google/go-gcm
- package: github.com/sideshow/apns2 - package: github.com/sideshow/apns2

View File

@ -2,7 +2,6 @@ package gorush
import ( import (
"fmt" "fmt"
"github.com/appleboy/endless"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
api "gopkg.in/appleboy/gin-status-api.v1" api "gopkg.in/appleboy/gin-status-api.v1"
"net/http" "net/http"
@ -81,15 +80,3 @@ func routerEngine() *gin.Engine {
return r 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
}