log
parent
115d68181f
commit
5a9249d29b
|
@ -38,7 +38,9 @@ import sun.misc.BASE64Encoder;
|
|||
import java.io.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
|
@ -51,7 +53,7 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
|||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ProtocolsManager.class);
|
||||
private static ProtocolsManager instance = new ProtocolsManager();
|
||||
public static PrintStream ps= null;// 创建文件输出流
|
||||
public static Map<MessageTypeProto.MessageType, String> gameMessageForLogin = new ConcurrentHashMap<>();
|
||||
private Map<Integer, BaseHandler> handlers = new HashMap<>();
|
||||
|
||||
private ProtocolsManager() {
|
||||
|
@ -109,7 +111,9 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
|||
PacketNetData packetNetData = new PacketNetData((byte[]) obj);
|
||||
// int msgId = packetNetData.getMsgId();
|
||||
// MessageTypeProto.MessageType messageType = MessageTypeProto.MessageType.valueOf(msgId);
|
||||
// ps.println(messageType + "=" + gson.toJson(obj));
|
||||
// if (!gameMessageForLogin.containsKey(messageType)){
|
||||
// gameMessageForLogin.put(messageType,messageType + "=" + gson.toJson(obj));
|
||||
// }
|
||||
if (packetNetData.getMsgId()==1000){
|
||||
dealHeartBeat(session);
|
||||
return;
|
||||
|
@ -307,7 +311,19 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
|||
LOGGER.info("player offLine ...");
|
||||
ISession session = (ISession) gameSession;
|
||||
synchronized (session) {
|
||||
|
||||
//输出日志
|
||||
// PrintStream ps= null;
|
||||
// try {
|
||||
// ps = new PrintStream("tmp/game.txt");
|
||||
// Map<MessageTypeProto.MessageType, String> gameMessageForLogin = ProtocolsManager.gameMessageForLogin;
|
||||
// for (Map.Entry<MessageTypeProto.MessageType, String> entry :gameMessageForLogin.entrySet()){
|
||||
// String value = entry.getValue();
|
||||
// ps.println(value);
|
||||
// }
|
||||
// ps.close();
|
||||
// } catch (FileNotFoundException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
if (session.getCtx() != null) {
|
||||
GameMessageHandler.allChannels.remove(session.getCtx().channel());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue