fixc resend
parent
b0ef60d864
commit
93643930c6
|
@ -359,14 +359,20 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void offLine(GameSession gameSession) {
|
public void offLine(GameSession gameSession) {
|
||||||
LOGGER.info("player offLine ...");
|
|
||||||
ISession session = (ISession) gameSession;
|
ISession session = (ISession) gameSession;
|
||||||
|
LOGGER.info("player offLine ..{}",session.getUid());
|
||||||
synchronized (session) {
|
synchronized (session) {
|
||||||
|
if (session.getUid() == 0) {
|
||||||
|
LOGGER.error("offLine->uid={}", session.getUid());
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(session.getOfflineType() == ErrorCode.reloginCode){
|
if(session.getOfflineType() == ErrorCode.reloginCode){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
User user = UserManager.getUserInMem(session.getUid());
|
User user = UserManager.getUserInMem(session.getUid());
|
||||||
if(user == null){
|
if(user == null){
|
||||||
|
LOGGER.info("the uid={},not in mem",session.getUid());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserLoginOutEvent,1);
|
KtEventUtils.onKtEvent(user, ParamEventBean.UserLoginOutEvent,1);
|
||||||
|
@ -377,10 +383,7 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
||||||
GameMessageHandler.allChannels.remove(session.getCtx().channel());
|
GameMessageHandler.allChannels.remove(session.getCtx().channel());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (session.getUid() == 0) {
|
|
||||||
LOGGER.error("offLine->uid={}", session.getUid());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GameMessageHandler.currentSessions.remove(session.getUid());
|
GameMessageHandler.currentSessions.remove(session.getUid());
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -4,6 +4,8 @@ import com.ljsd.jieling.logic.OnlineUserManager;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
import com.ljsd.jieling.util.MessageUtil;
|
import com.ljsd.jieling.util.MessageUtil;
|
||||||
|
import io.netty.channel.ChannelFutureListener;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import util.TimeUtils;
|
import util.TimeUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -40,36 +42,25 @@ public class RetrySendIndicationThread extends Thread{
|
||||||
long now = TimeUtils.now();
|
long now = TimeUtils.now();
|
||||||
Set<Integer> removeIds = new HashSet<>();
|
Set<Integer> removeIds = new HashSet<>();
|
||||||
for(ISession session : sessionMap.values()){
|
for(ISession session : sessionMap.values()){
|
||||||
if(session.getCtx() == null || session.getCtx().channel() == null){
|
ChannelHandlerContext localCtx = session.getCtx();
|
||||||
removeIds.add(session.getUid());
|
if ((localCtx != null) && (localCtx.channel() != null) && (localCtx.channel().isOpen())
|
||||||
continue;
|
&& (localCtx.channel().isActive()) && (localCtx.channel().isWritable())) {
|
||||||
}
|
|
||||||
if(session.getFiveReady() == 1 && session.getFiveByteBuf()!=null){
|
if(session.getFiveReady() == 1 && session.getFiveByteBuf()!=null){
|
||||||
session.putBackIndicationToMap(MessageTypeProto.MessageType.FIVE_PLAYER_REFLUSH_INDICATION_VALUE,session.getFiveByteBuf());
|
session.putBackIndicationToMap(MessageTypeProto.MessageType.FIVE_PLAYER_REFLUSH_INDICATION_VALUE,session.getFiveByteBuf());
|
||||||
session.setFiveByteBuf(null);
|
session.setFiveByteBuf(null);
|
||||||
}
|
}
|
||||||
ConcurrentHashMap<Integer, ISession.IndicationMsg> indexToIndication = session.getIndexToIndication();
|
ConcurrentHashMap<Integer, ISession.IndicationMsg> indexToIndication = session.getIndexToIndication();
|
||||||
boolean send = false;
|
|
||||||
for(ISession.IndicationMsg indicationMsg : indexToIndication.values()){
|
for(ISession.IndicationMsg indicationMsg : indexToIndication.values()){
|
||||||
long create = indicationMsg.getCreate();
|
long create = indicationMsg.getCreate();
|
||||||
int retryTimes = indicationMsg.getRetryTimes()+1;
|
int retryTimes = indicationMsg.getRetryTimes()+1;
|
||||||
if(now-create>retryTimes*300){
|
if(now-create>retryTimes*300){
|
||||||
if(session.getUid() == 20000739){
|
|
||||||
Calendar calendar = Calendar.getInstance();
|
|
||||||
int i = calendar.get(Calendar.MINUTE);
|
|
||||||
if(i%2==0 && !send){
|
|
||||||
for(Integer id : indexToIndication.keySet()){
|
|
||||||
LOGGER.info("indication id={}",id);
|
|
||||||
}
|
|
||||||
send = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
MessageUtil.retrySendIndication(session,indicationMsg.getMsg());
|
MessageUtil.retrySendIndication(session,indicationMsg.getMsg());
|
||||||
indicationMsg.setRetryTimes(retryTimes);
|
indicationMsg.setRetryTimes(retryTimes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
removeIds.add(session.getUid());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for(Integer removeId:removeIds ){
|
for(Integer removeId:removeIds ){
|
||||||
OnlineUserManager.sessionMap.remove(removeId);
|
OnlineUserManager.sessionMap.remove(removeId);
|
||||||
|
|
Loading…
Reference in New Issue