11package info .xiaomo .gengine .network .client ;
22
3- import com .google .protobuf .AbstractMessage ;
43import java .util .Map ;
54import info .xiaomo .gengine .network .INetworkConsumer ;
65import info .xiaomo .gengine .network .INetworkEventListener ;
6+ import info .xiaomo .gengine .network .MsgPack ;
77import info .xiaomo .gengine .network .handler .MessageExecutor ;
88import io .netty .channel .ChannelHandlerContext ;
99import io .netty .handler .timeout .IdleState ;
@@ -15,30 +15,32 @@ public class ClientMessageExecutor extends MessageExecutor {
1515
1616 public static final Logger LOGGER = LoggerFactory .getLogger (ClientMessageExecutor .class );
1717
18- protected Map <Short , ClientFuture <AbstractMessage >> futureMap ;
18+ protected Map <Short , ClientFuture <MsgPack >> futureMap ;
19+
20+ protected boolean idleCheck ;
1921
2022 public ClientMessageExecutor (
2123 INetworkConsumer consumer ,
2224 INetworkEventListener listener ,
23- Map <Short , ClientFuture <AbstractMessage >> futureMap ,
25+ Map <Short , ClientFuture <MsgPack >> futureMap ,
2426 boolean idleCheck ) {
2527 super (consumer , listener );
2628 this .futureMap = futureMap ;
29+ this .idleCheck = idleCheck ;
2730 }
2831
2932 @ Override
3033 public void channelRead (ChannelHandlerContext ctx , Object msg ) throws Exception {
3134
32- // AbstractMessage m = (AbstractMessage) msg;
33- // ClientFuture<AbstractMessage> f = futureMap.get(m.getSequence());
34- // if (f != null) {
35- // if (!f.isCancelled()) {
36- // f.result(m);
37- // }
38- // } else {
39- super .channelRead (ctx , msg );
40- // }
41-
35+ MsgPack m = (MsgPack ) msg ;
36+ ClientFuture <MsgPack > f = futureMap .get (m .getSequence ());
37+ if (f != null ) {
38+ if (!f .isCancelled ()) {
39+ f .result (m );
40+ }
41+ } else {
42+ super .channelRead (ctx , msg );
43+ }
4244 }
4345
4446 @ Override
0 commit comments