예제 #1
0
        public void addToSendQueue(Packet packet)
        {
            if (m_isServerTerminating)
            {
                return;
            }

            lock (sendQueueLock)
            {
                sendQueueByteLength += packet.getPacketSize() + 1;
                if (packet.isChunkDataPacket)
                {
                    chunkDataPackets.add(packet);
                }
                else
                {
                    dataPackets.add(packet);
                }
            }
        }
예제 #2
0
        public static Packet readPacket(DataInputStream datainputstream)
        {
            int    i      = 0;
            Packet packet = null;

            datainputstream.mark(16384);
            try
            {
                i = datainputstream.read();
                if (i == -1)
                {
                    return(null);
                }
                packet = getNewPacket(i);
                if (packet == null)
                {
                    throw new IOException((new StringBuilder()).append("Bad packet id ").append(i).toString());
                }
                packet.readPacketData(datainputstream);
            }
            catch (EOFException eofexception)
            {
                [email protected]("Reached end of stream");
                datainputstream.reset();
                return(null);
            }
            var packetcounter = (PacketCounter)field_21904_c.get(Integer.valueOf(i));

            if (packetcounter == null)
            {
                packetcounter = new PacketCounter(null);
                field_21904_c.put(Integer.valueOf(i), packetcounter);
            }
            packetcounter.func_22150_a(packet.getPacketSize());
            field_21903_d++;
            if (field_21903_d % 1000 != 0)
            {
                ;
            }
            return(packet);
        }
예제 #3
0
        public void addToSendQueue(Packet packet)
        {
            if (m_isServerTerminating)
            {
                return;
            }

            lock (sendQueueLock)
            {
                sendQueueByteLength += packet.getPacketSize() + 1;
                if (packet.isChunkDataPacket)
                {
                    chunkDataPackets.add(packet);
                }
                else
                {
                    dataPackets.add(packet);
                }
            }
        }