fix
This commit is contained in:
parent
37d32a26ab
commit
530d711f75
|
@ -36,11 +36,24 @@ func (w *wsConnectItem) reuseLastConnect(data []byte) {
|
||||||
publicMutex.Lock()
|
publicMutex.Lock()
|
||||||
defer publicMutex.Unlock()
|
defer publicMutex.Unlock()
|
||||||
//存在是不能给他申请重新绑定
|
//存在是不能给他申请重新绑定
|
||||||
if _, ok := mapConnPool.Load(clientId); ok {
|
if v, ok := mapConnPool.Load(clientId); ok {
|
||||||
|
obj, ok := v.(wsConnectItem)
|
||||||
|
if !ok {
|
||||||
|
logx.Error("连接断言失败")
|
||||||
|
}
|
||||||
|
//是当前自己占用
|
||||||
|
if obj.uniqueId == w.uniqueId {
|
||||||
|
//重新绑定
|
||||||
|
w.uniqueId = clientId
|
||||||
|
rsp := w.respondDataFormat(constants.WEBSOCKET_CONNECT_SUCCESS, clientId)
|
||||||
|
w.sendToOutChan(rsp)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
rsp := w.respondDataFormat(constants.WEBSOCKET_REQUEST_RESUME_LAST_CONNECT_ERR, "id has bound by other connect ")
|
rsp := w.respondDataFormat(constants.WEBSOCKET_REQUEST_RESUME_LAST_CONNECT_ERR, "id has bound by other connect ")
|
||||||
w.sendToOutChan(rsp)
|
w.sendToOutChan(rsp)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//重新绑定
|
//重新绑定
|
||||||
w.uniqueId = clientId
|
w.uniqueId = clientId
|
||||||
rsp := w.respondDataFormat(constants.WEBSOCKET_CONNECT_SUCCESS, clientId)
|
rsp := w.respondDataFormat(constants.WEBSOCKET_CONNECT_SUCCESS, clientId)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user