fix
This commit is contained in:
parent
5a56ce7918
commit
961183d17b
@ -190,7 +190,7 @@ func (l *DataTransferLogic) setConnPool(conn *websocket.Conn, userInfo *auth.Use
|
|||||||
}
|
}
|
||||||
lendecryptionWid := len(decryptionWid)
|
lendecryptionWid := len(decryptionWid)
|
||||||
//合成client后缀,不是同个后缀的不能复用
|
//合成client后缀,不是同个后缀的不能复用
|
||||||
userPart := getUserJoinPart(userInfo.UserId, userInfo.GuestId, userAgent)
|
userPart := getUserPart(userInfo.UserId, userInfo.GuestId, userAgent)
|
||||||
lenUserPart := len(userPart)
|
lenUserPart := len(userPart)
|
||||||
//长度太短
|
//长度太短
|
||||||
if lendecryptionWid <= lenUserPart {
|
if lendecryptionWid <= lenUserPart {
|
||||||
@ -263,7 +263,7 @@ func (l *DataTransferLogic) getUniqueId(userInfo *auth.UserInfo, userAgent strin
|
|||||||
return "", errors.New("failed to get unique id")
|
return "", errors.New("failed to get unique id")
|
||||||
}
|
}
|
||||||
//后面拼接上用户id
|
//后面拼接上用户id
|
||||||
uniqueId = hex.EncodeToString([]byte(uuid.New().String())) + getUserJoinPart(userInfo.UserId, userInfo.GuestId, userAgent)
|
uniqueId = hex.EncodeToString([]byte(uuid.New().String())) + getUserPart(userInfo.UserId, userInfo.GuestId, userAgent)
|
||||||
//存在则从新获取
|
//存在则从新获取
|
||||||
if _, ok := mapConnPool.Load(uniqueId); ok {
|
if _, ok := mapConnPool.Load(uniqueId); ok {
|
||||||
uniqueId, err = l.getUniqueId(userInfo, userAgent, retryTimes-1)
|
uniqueId, err = l.getUniqueId(userInfo, userAgent, retryTimes-1)
|
||||||
@ -445,7 +445,7 @@ func (w *wsConnectItem) respondDataFormat(msgType constants.Websocket, data inte
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户拼接部分(复用标识用到)
|
// 获取用户拼接部分(复用标识用到)
|
||||||
func getUserJoinPart(userId, guestId int64, userAgent string) string {
|
func getUserPart(userId, guestId int64, userAgent string) string {
|
||||||
if userId > 0 {
|
if userId > 0 {
|
||||||
guestId = 0
|
guestId = 0
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user