From fbbe4921c96bdd0c345bbe7ab1ae862e683e433f Mon Sep 17 00:00:00 2001 From: poiuty Date: Mon, 3 Jul 2023 19:49:17 +0300 Subject: [PATCH] fix deadlock if server deadlock --- app/main.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/main.go b/app/main.go index 2364d5e..6d3d92f 100644 --- a/app/main.go +++ b/app/main.go @@ -55,9 +55,9 @@ func main() { go saveLogs() go socketHandler() - http.HandleFunc("/cmd/", cmdHandler) - http.HandleFunc("/list/", listHandler) - http.HandleFunc("/debug/", debugHandler) + http.HandleFunc("/chaturbate/cmd/", cmdHandler) + http.HandleFunc("/chaturbate/list/", listHandler) + http.HandleFunc("/chaturbate/debug/", debugHandler) go fastStart() @@ -99,8 +99,8 @@ func socketHandler() { select { case b := <-socketServer: - if conn == nil { - conn, err = net.Dial("unix", "/tmp/echo.sock") + if conn == nil || conn.RemoteAddr() == nil { + conn, err = net.DialTimeout("unix", "/tmp/echo.sock", time.Second*5) if err != nil { fmt.Println(err.Error()) continue