Commit a90eadb8 authored by Chunchi Che's avatar Chunchi Che

update small

parent 625a7061
...@@ -51,6 +51,8 @@ func ygoEndpoint(w http.ResponseWriter, r *http.Request) { ...@@ -51,6 +51,8 @@ func ygoEndpoint(w http.ResponseWriter, r *http.Request) {
} }
func wsProxy(ws *websocket.Conn, tcp *net.Conn, wg *sync.WaitGroup) { func wsProxy(ws *websocket.Conn, tcp *net.Conn, wg *sync.WaitGroup) {
defer wg.Done()
for { for {
messageType, buffer, err := ws.ReadMessage() messageType, buffer, err := ws.ReadMessage()
if err != nil { if err != nil {
...@@ -75,11 +77,11 @@ func wsProxy(ws *websocket.Conn, tcp *net.Conn, wg *sync.WaitGroup) { ...@@ -75,11 +77,11 @@ func wsProxy(ws *websocket.Conn, tcp *net.Conn, wg *sync.WaitGroup) {
break break
} }
} }
wg.Done()
} }
func tcpProxy(tcp *net.Conn, ws *websocket.Conn, wg *sync.WaitGroup) { func tcpProxy(tcp *net.Conn, ws *websocket.Conn, wg *sync.WaitGroup) {
defer wg.Done()
reader := bufio.NewReader(*tcp) reader := bufio.NewReader(*tcp)
buffer := make([]byte, BUFFER_SIZE) buffer := make([]byte, BUFFER_SIZE)
...@@ -106,8 +108,6 @@ func tcpProxy(tcp *net.Conn, ws *websocket.Conn, wg *sync.WaitGroup) { ...@@ -106,8 +108,6 @@ func tcpProxy(tcp *net.Conn, ws *websocket.Conn, wg *sync.WaitGroup) {
break break
} }
} }
wg.Done()
} }
func wsChecker(r *http.Request) bool { return true } func wsChecker(r *http.Request) bool { return true }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment