mirror of
https://github.com/Mahdi-zarei/nekoray.git
synced 2025-12-25 11:00:07 +08:00
fix start core signal
This commit is contained in:
parent
17d5499035
commit
902a15e85c
@ -7,6 +7,7 @@ import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
"runtime"
|
||||
runtimeDebug "runtime/debug"
|
||||
@ -45,7 +46,17 @@ func RunCore() {
|
||||
boxmain.DisableColor()
|
||||
|
||||
// RPC
|
||||
go func() {
|
||||
for {
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
conn, err := net.Dial("tcp", "127.0.0.1:"+strconv.Itoa(*_port))
|
||||
if err == nil {
|
||||
conn.Close()
|
||||
fmt.Printf("Core listening at %v\n", "127.0.0.1:"+strconv.Itoa(*_port))
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
err := gen.ListenAndServeLibcoreService("tcp", "127.0.0.1:"+strconv.Itoa(*_port), new(server))
|
||||
if err != nil {
|
||||
log.Fatalf("failed to listen: %v", err)
|
||||
|
||||
@ -49,7 +49,7 @@ func (s *server) Start(in *gen.LoadConfigReq, out *gen.ErrorResp) (_ error) {
|
||||
}()
|
||||
|
||||
if debug {
|
||||
log.Println("Start:", in.CoreConfig)
|
||||
log.Println("Start:", *in.CoreConfig)
|
||||
}
|
||||
|
||||
if boxInstance != nil {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user