fix issue in reload feature in ghttp.Server

This commit is contained in:
John 2020-06-28 20:52:33 +08:00
parent efc0501548
commit 2f44721086
3 changed files with 4 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import (
func main() {
s := g.Server()
s.EnableAdmin()
//s.BindHookHandler("/admin/*any", ghttp.HOOK_BEFORE_SERVE, func(r *ghttp.Request) {
// if !r.BasicAuth("admin", "123", "") {
// r.Exit()

View File

@ -183,6 +183,7 @@ func init() {
// which is false in default.
//
// Note that this feature switch is not for single server instance but for whole process.
// Deprecated, use configuration of ghttp.Server for controlling this feature.
func SetGraceful(enabled bool) {
gracefulEnabled = enabled
}

View File

@ -10,6 +10,7 @@ import (
"bytes"
"errors"
"fmt"
"github.com/gogf/gf/text/gstr"
"os"
"runtime"
"strings"
@ -112,7 +113,7 @@ func forkReloadProcess(newExeFilePath ...string) error {
for fdk, fdv := range m {
if len(fdv) > 0 {
s := ""
for _, item := range strings.Split(fdv, ",") {
for _, item := range gstr.SplitAndTrim(fdv, ",") {
array := strings.Split(item, "#")
fd := uintptr(gconv.Uint(array[1]))
if fd > 0 {