fix deadlock if server deadlock

This commit is contained in:
poiuty 2023-07-03 19:49:17 +03:00
parent a5646a39f6
commit fbbe4921c9

View file

@ -55,9 +55,9 @@ func main() {
go saveLogs() go saveLogs()
go socketHandler() go socketHandler()
http.HandleFunc("/cmd/", cmdHandler) http.HandleFunc("/chaturbate/cmd/", cmdHandler)
http.HandleFunc("/list/", listHandler) http.HandleFunc("/chaturbate/list/", listHandler)
http.HandleFunc("/debug/", debugHandler) http.HandleFunc("/chaturbate/debug/", debugHandler)
go fastStart() go fastStart()
@ -99,8 +99,8 @@ func socketHandler() {
select { select {
case b := <-socketServer: case b := <-socketServer:
if conn == nil { if conn == nil || conn.RemoteAddr() == nil {
conn, err = net.Dial("unix", "/tmp/echo.sock") conn, err = net.DialTimeout("unix", "/tmp/echo.sock", time.Second*5)
if err != nil { if err != nil {
fmt.Println(err.Error()) fmt.Println(err.Error())
continue continue