mirror of
https://github.com/statbate/animated-sniffle.git
synced 2026-08-11 02:12:41 +00:00
update
This commit is contained in:
parent
0ca280b452
commit
51ebbd9a8b
1 changed files with 22 additions and 4 deletions
26
app/main.go
26
app/main.go
|
|
@ -92,14 +92,32 @@ func initClickhouse() {
|
|||
}
|
||||
|
||||
func socketHandler() {
|
||||
|
||||
var(
|
||||
err error
|
||||
conn net.Conn
|
||||
)
|
||||
|
||||
for {
|
||||
select {
|
||||
case b := <-socketServer:
|
||||
conn, err := net.Dial("unix", "/tmp/echo.sock")
|
||||
if err == nil {
|
||||
conn.Write(b)
|
||||
conn.Close()
|
||||
|
||||
if conn == nil {
|
||||
conn, err = net.Dial("unix", "/tmp/echo.sock")
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if conn != nil {
|
||||
if _, err = conn.Write(b); err != nil {
|
||||
fmt.Println(err.Error())
|
||||
conn.Close()
|
||||
conn = nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue