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