From 32657e2f59b02e12fc0d62e80f5639564bece541 Mon Sep 17 00:00:00 2001 From: poiuty Date: Mon, 3 Jul 2023 23:43:31 +0300 Subject: [PATCH] update --- app/main.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/main.go b/app/main.go index 3544654..b26a5dc 100644 --- a/app/main.go +++ b/app/main.go @@ -28,10 +28,10 @@ var ( json = jsoniter.ConfigCompatibleWithStandardLibrary - socketServer = make(chan []byte, 100) + socketServer = make(chan []byte, 1) - save = make(chan saveData, 100) - slog = make(chan saveLog, 100) + save = make(chan saveData, 1) + slog = make(chan saveLog, 32) rooms = &Rooms{ Count: make(chan int), @@ -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.Millisecond * 10) if err != nil { fmt.Println(err.Error()) continue