Fix unable to save game data occasionally (#1194)

* Fix unable to save game data occasionally

* No self-kicking

* Game data synchronization

* finally

* prevent duplicated saving

* reverse changing

* keep the previous code

* Update GameServerInitializer.java

* Update GameSession.java

* remove sanity check because of try block

* a session needs can be created without a pipeline.
This commit is contained in:
zhaodice
2022-06-05 19:23:19 +08:00
committed by GitHub
Unverified
parent 934fb5873a
commit ecf7a81ad1
6 changed files with 120 additions and 59 deletions
@@ -13,8 +13,10 @@ public class GameServerInitializer extends KcpServerInitializer {
@Override
protected void initChannel(UkcpChannel ch) throws Exception {
ChannelPipeline pipeline = ch.pipeline();
GameSession session = new GameSession(server);
pipeline.addLast(session);
ChannelPipeline pipeline=null;
if(ch!=null){
pipeline = ch.pipeline();
}
new GameSession(server,pipeline);
}
}