]> git.lizzy.rs Git - minetest.git/blobdiff - src/connection.cpp
Increase step smoothing to fit 1:1 stairs (works well on slabs too)
[minetest.git] / src / connection.cpp
index 2f9339e6ae2da5977f2b0dadfff2c46797b9df09..64ef9a50e42f9638008adeb0f9273190212068f8 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()));
@@ -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;
@@ -2143,7 +2143,9 @@ void ConnectionReceiveThread::receive()
                        LOG(derr_con<<m_connection->getDesc()
                                        <<"Receive(): Invalid incoming packet, "
                                        <<"size: " << received_size
-                                       <<", protocol: " << readU32(&packetdata[0]) <<std::endl);
+                                       <<", protocol: "
+                                       << ((received_size >= 4) ? readU32(&packetdata[0]) : -1)
+                                       << std::endl);
                        continue;
                }
 
@@ -2320,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");