refactor(watchdog): remove tcp socket connection and add local unix sock connection
This commit is contained in:
@@ -6,7 +6,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
func Connect(ipaddr string, port int) bool {
|
||||
func Connect() bool {
|
||||
if IsConnected() {
|
||||
return true
|
||||
}
|
||||
@@ -18,7 +18,7 @@ func Connect(ipaddr string, port int) bool {
|
||||
deadline := time.Now().Add(5 * time.Second)
|
||||
var lastErr error
|
||||
for {
|
||||
if err := tcpConnect(ipaddr, port); err == nil {
|
||||
if err := localSocketConnect(); err == nil {
|
||||
break
|
||||
} else {
|
||||
lastErr = err
|
||||
@@ -58,6 +58,8 @@ func Disconnect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
KillWatchdogProcess()
|
||||
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user