mirror of
https://github.com/statbate/shiny-potato.git
synced 2026-08-11 03:12:42 +00:00
update
This commit is contained in:
parent
d42503ad10
commit
e5a0cb01f9
1 changed files with 22 additions and 4 deletions
26
app/main.go
26
app/main.go
|
|
@ -92,15 +92,33 @@ func initClickhouse() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func socketHandler() {
|
func socketHandler() {
|
||||||
|
|
||||||
|
var(
|
||||||
|
err error
|
||||||
|
conn net.Conn
|
||||||
|
)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case b := <-socketServer:
|
case b := <-socketServer:
|
||||||
conn, err := net.Dial("unix", "/tmp/echo.sock")
|
|
||||||
if err == nil {
|
if conn == nil {
|
||||||
conn.Write(b)
|
conn, err = net.Dial("unix", "/tmp/echo.sock")
|
||||||
conn.Close()
|
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