Kryonet - 双传入数据包

Kryonet - double incoming packets

好的。我只收到一次数据包,但它的块被触发了两次。例如:

我有一个这样的块:

           if (object instanceof InitTheGame) {
                System.out.println("STARTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT");
                awaitOpponent.dismiss();
                isInQueue = false;
                matchRunning = true; // handles the while loop inside the thread that sends data to the server
                isInMatch = true; // handles view (checks for this if we exit the app)
                // new GamePacketSender().start();
                casualGameHolder.gameLoop.start();
                new Sensor(act, casualGameHolder.gameLoop);
                touchListener = new TouchListener(casualGameHolder.gameLoop);
                this_layout.setOnTouchListener(touchListener);

                act.runOnUiThread(new Runnable() {
                    public void run() {
                        GameStartCountdown countdown = new GameStartCountdown(4000,1000);
                        countdown.start();
                        countdownDialog = new Dialog(act);
                        countdownDialog.show();
                        countdownDialog.setCancelable(false);
                    }
                });
            }

在控制台中 (LOG_TRACE) 我可以看到,数据包只收到一次,但是 "STARTTTTTTTTTTTTTTTTT" System.out 显示两次,倒计时显示两次等

我不想 post 整个代码,因为它太大而且难以理解。这可能是由于服务器上的缓冲区溢出引起的,或者可能是因为我在一台设备上同时打开了两个连接?如果有哪位有 Kryonet 经验的人帮忙,我将不胜感激。

注册多个监听器导致(游戏结束后应该为null)