]> git.lizzy.rs Git - minetest.git/blobdiff - src/connection.cpp
Make limiting of the reflow liquids queue size optional
[minetest.git] / src / connection.cpp
index bd0d872caf5a3f08c00b7825e5746b2a3181d973..cf5be7ed6aaebe4779da849fc8bf932a0e95478a 100644 (file)
@@ -1300,7 +1300,7 @@ void * ConnectionSendThread::Thread()
                /* send non reliable packets */
                sendPackets(dtime);
 
-               END_DEBUG_EXCEPTION_HANDLER(derr_con);
+               END_DEBUG_EXCEPTION_HANDLER(errorstream);
        }
 
        PROFILE(g_profiler->remove(ThreadIdentifier.str()));
@@ -1316,7 +1316,7 @@ bool ConnectionSendThread::packetsQueued()
 {
        std::list<u16> peerIds = m_connection->getPeerIDs();
 
-       if ((this->m_outgoing_queue.size() > 0) && (peerIds.size() > 0))
+       if (!m_outgoing_queue.empty() && !peerIds.empty())
                return true;
 
        for(std::list<u16>::iterator j = peerIds.begin();
@@ -2085,7 +2085,7 @@ void * ConnectionReceiveThread::Thread()
                        }
                }
 #endif
-               END_DEBUG_EXCEPTION_HANDLER(derr_con);
+               END_DEBUG_EXCEPTION_HANDLER(errorstream);
        }
        PROFILE(g_profiler->remove(ThreadIdentifier.str()));
        return NULL;
@@ -2322,7 +2322,12 @@ bool ConnectionReceiveThread::checkIncomingBuffers(Channel *channel,
 SharedBuffer<u8> ConnectionReceiveThread::processPacket(Channel *channel,
                SharedBuffer<u8> packetdata, u16 peer_id, u8 channelnum, bool reliable)
 {
-       PeerHelper peer = m_connection->getPeer(peer_id);
+       PeerHelper peer = m_connection->getPeerNoEx(peer_id);
+
+       if (!peer) {
+               errorstream << "Peer not found (possible timeout)" << std::endl;
+               throw ProcessedSilentlyException("Peer not found (possible timeout)");
+       }
 
        if(packetdata.getSize() < 1)
                throw InvalidIncomingDataException("packetdata.getSize() < 1");