Remove misdesigned exception from ReliablePacketBuffer
authorPerttu Ahola <celeron55@gmail.com>
Mon, 4 Jun 2012 19:43:33 +0000 (22:43 +0300)
committerPerttu Ahola <celeron55@gmail.com>
Mon, 4 Jun 2012 19:43:33 +0000 (22:43 +0300)
src/connection.cpp

index 127cabdc51ead787e586cb7069b662fca840370c..5bf47f13c2b861bd09d392761fa384c86568c77e 100644 (file)
@@ -353,9 +353,11 @@ SharedBuffer<u8> IncomingSplitBuffer::insert(BufferedPacket &p, bool reliable)
                                <<" != sp->reliable="<<sp->reliable
                                <<std::endl;
 
-       // If chunk already exists, cancel
+       // If chunk already exists, ignore it.
+       // Sometimes two identical packets may arrive when there is network
+       // lag and the server re-sends stuff.
        if(sp->chunks.find(chunk_num) != NULL)
-               throw AlreadyExistsException("Chunk already in buffer");
+               return SharedBuffer<u8>();
        
        // Cut chunk data out of packet
        u32 chunkdatasize = p.data.getSize() - headersize;