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