fix relogin
parent
e11257f348
commit
a08d6048ba
|
@ -158,7 +158,7 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
||||||
dealHeartBeat(session);
|
dealHeartBeat(session);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (packetNetData.getMsgId()== MessageTypeProto.MessageType.LOGIN_REQUEST_VALUE ||
|
if (packetNetData.getMsgId()== MessageTypeProto.MessageType.LOGIN_REQUEST_VALUE ||
|
||||||
packetNetData.getMsgId()== MessageTypeProto.MessageType.RECONNECT_REQUEST_VALUE){
|
packetNetData.getMsgId()== MessageTypeProto.MessageType.RECONNECT_REQUEST_VALUE){
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//处理多设备重登
|
//处理多设备重登
|
||||||
if(dealRepeatLogin(session.getUid()) == 1){
|
if(dealRepeatLogin(session) == 1){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//刷新token
|
//刷新token
|
||||||
|
@ -305,9 +305,13 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private int dealRepeatLogin(int uid) {
|
private int dealRepeatLogin(ISession newSession) {
|
||||||
|
int uid = newSession.getUid();
|
||||||
if (OnlineUserManager.checkUidOnline(uid)){
|
if (OnlineUserManager.checkUidOnline(uid)){
|
||||||
ISession iSession = OnlineUserManager.getSessionByUid(uid);
|
ISession iSession = OnlineUserManager.getSessionByUid(uid);
|
||||||
|
if(iSession == newSession){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
MessageUtil.sendErrorCode(iSession, ErrorCode.reloginCode,"您的账号已经在其他设备上登陆,请确认账号安全!");
|
MessageUtil.sendErrorCode(iSession, ErrorCode.reloginCode,"您的账号已经在其他设备上登陆,请确认账号安全!");
|
||||||
iSession.setOfflineType(ErrorCode.reloginCode);
|
iSession.setOfflineType(ErrorCode.reloginCode);
|
||||||
backUpMsgToRedis(iSession);
|
backUpMsgToRedis(iSession);
|
||||||
|
@ -318,9 +322,9 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
private int checkIndex(ISession iSession, PacketNetData packetNetData) {
|
private int checkIndex(ISession iSession, PacketNetData packetNetData) {
|
||||||
if(packetNetData.getMsgId() == MessageTypeProto.MessageType.LOGIN_REQUEST_VALUE || packetNetData.getMsgId() == MessageTypeProto.MessageType.RECONNECT_REQUEST_VALUE){
|
/* if(packetNetData.getMsgId() == MessageTypeProto.MessageType.LOGIN_REQUEST_VALUE || packetNetData.getMsgId() == MessageTypeProto.MessageType.RECONNECT_REQUEST_VALUE){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}*/
|
||||||
int index = packetNetData.getIndex();
|
int index = packetNetData.getIndex();
|
||||||
if (iSession.getIndex() >= index){
|
if (iSession.getIndex() >= index){
|
||||||
byte[] message = iSession.getCacheMessage(index);
|
byte[] message = iSession.getCacheMessage(index);
|
||||||
|
|
Loading…
Reference in New Issue