fix reconnect
parent
0f229baaa4
commit
7d84edc660
|
@ -232,12 +232,8 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
||||||
if(indicationInRedis!=null){
|
if(indicationInRedis!=null){
|
||||||
Map<Integer, ISession.IndicationMsg> map= gson.fromJson(indicationInRedis.toString(),type);
|
Map<Integer, ISession.IndicationMsg> map= gson.fromJson(indicationInRedis.toString(),type);
|
||||||
for(Map.Entry<Integer,ISession.IndicationMsg> info : map.entrySet()){
|
for(Map.Entry<Integer,ISession.IndicationMsg> info : map.entrySet()){
|
||||||
Integer msgIndex = info.getKey();
|
|
||||||
session.writeAndFlush(info.getValue().getMsg());
|
session.writeAndFlush(info.getValue().getMsg());
|
||||||
session.putBackIndicationToMap(msgIndex,info.getValue().getMsg());
|
session.putBackIndicationToMap(maxMsgId++,info.getValue().getMsg());
|
||||||
if(maxMsgId<msgIndex){
|
|
||||||
maxMsgId = msgIndex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
RedisUtil.getInstence().del(key);
|
RedisUtil.getInstence().del(key);
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,23 +50,10 @@ public class RetrySendIndicationThread extends Thread{
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue