正确处理连接断开逻辑

This commit is contained in:
lwch
2021-11-04 10:36:05 +08:00
parent e3f5494d25
commit 832b1edc8f
+1
View File
@@ -36,6 +36,7 @@ func (v *VNC) WS(pool *pool.Pool, w http.ResponseWriter, r *http.Request) {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
defer local.Close()
ch := conn.ChanRead(id)
defer conn.SendDisconnect(v.link.target, v.link.targetIdx, v.link.id)
ctx, cancel := context.WithCancel(context.Background())