pull/455/head
skiffer-git 3 years ago committed by Xinwei Xiong(cubxxw-openim)
parent 87fed2bb0f
commit 4e8b240dc6

@ -105,9 +105,9 @@ func (ws *WServer) MultiTerminalLoginChecker(uid string, platformID int32, newCo
case constant.AllLoginButSameTermKick: case constant.AllLoginButSameTermKick:
if oldConnMap, ok := ws.wsUserToConn[uid]; ok { // user->map[platform->conn] if oldConnMap, ok := ws.wsUserToConn[uid]; ok { // user->map[platform->conn]
if oldConn, ok := oldConnMap[constant.PlatformIDToName(platformID)]; ok { if oldConn, ok := oldConnMap[constant.PlatformIDToName(platformID)]; ok {
log.NewDebug(operationID, uid, platformID, "kick old conn") log.NewWarn(operationID, uid, platformID, "kick old conn begin")
ws.sendKickMsg(oldConn, newConn) ws.sendKickMsg(oldConn, newConn)
log.NewDebug(operationID, uid, platformID, "kick old conn") log.NewWarn(operationID, uid, platformID, "kick old conn end")
m, err := db.DB.GetTokenMapByUidPid(uid, constant.PlatformIDToName(platformID)) m, err := db.DB.GetTokenMapByUidPid(uid, constant.PlatformIDToName(platformID))
if err != nil && err != redis.ErrNil { if err != nil && err != redis.ErrNil {
log.NewError(operationID, "get token from redis err", err.Error()) log.NewError(operationID, "get token from redis err", err.Error())
@ -167,7 +167,7 @@ func (ws *WServer) sendKickMsg(oldConn, newConn *UserConn) {
ws.SetWriteTimeout(oldConn, 5) ws.SetWriteTimeout(oldConn, 5)
err = ws.writeMsg(oldConn, websocket.BinaryMessage, b.Bytes()) err = ws.writeMsg(oldConn, websocket.BinaryMessage, b.Bytes())
if err != nil { if err != nil {
log.NewError(mReply.OperationID, mReply.ReqIdentifier, mReply.ErrCode, mReply.ErrMsg, "WS WriteMsg error", oldConn.RemoteAddr().String(), newConn.RemoteAddr().String(), err.Error()) log.NewError(mReply.OperationID, mReply.ReqIdentifier, mReply.ErrCode, mReply.ErrMsg, "sendKickMsg WS WriteMsg error", oldConn.RemoteAddr().String(), newConn.RemoteAddr().String(), err.Error())
} }
} }
func (ws *WServer) addUserConn(uid string, platformID int32, conn *UserConn, token string) { func (ws *WServer) addUserConn(uid string, platformID int32, conn *UserConn, token string) {

Loading…
Cancel
Save