fix
This commit is contained in:
parent
41909b7def
commit
810949c9d8
|
@ -93,7 +93,6 @@ func (l *DataTransferLogic) DataTransfer(w http.ResponseWriter, r *http.Request)
|
||||||
logx.Error("http upgrade websocket err:", err)
|
logx.Error("http upgrade websocket err:", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer conn.Close()
|
|
||||||
//鉴权不成功后断开
|
//鉴权不成功后断开
|
||||||
var (
|
var (
|
||||||
userInfo *auth.UserInfo
|
userInfo *auth.UserInfo
|
||||||
|
@ -103,11 +102,13 @@ func (l *DataTransferLogic) DataTransfer(w http.ResponseWriter, r *http.Request)
|
||||||
if !isAuth {
|
if !isAuth {
|
||||||
//未授权响应消息
|
//未授权响应消息
|
||||||
l.unAuthResponse(conn)
|
l.unAuthResponse(conn)
|
||||||
|
conn.Close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//设置连接
|
//设置连接
|
||||||
ws, err := l.setConnPool(conn, *userInfo)
|
ws, err := l.setConnPool(conn, *userInfo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
conn.Close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer ws.close()
|
defer ws.close()
|
||||||
|
@ -249,7 +250,6 @@ func (w *wsConnectItem) heartbeat() {
|
||||||
//发送心跳信息
|
//发送心跳信息
|
||||||
if err := w.conn.WriteMessage(websocket.PongMessage, nil); err != nil {
|
if err := w.conn.WriteMessage(websocket.PongMessage, nil); err != nil {
|
||||||
logx.Error("发送心跳信息异常,关闭连接:", w.uniqueId, err)
|
logx.Error("发送心跳信息异常,关闭连接:", w.uniqueId, err)
|
||||||
w.close()
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user