Merge pull request #6040 from huffman/fix-null-node

Fix case where we deref a null pointer in OctreeInboundPacketProcessor
This commit is contained in:
Stephen Birarda 2015-10-09 14:57:16 -07:00
commit b84109a781
6 changed files with 15 additions and 7 deletions

View file

@ -261,6 +261,12 @@ int OctreeInboundPacketProcessor::sendNackPackets() {
}
const SharedNodePointer& destinationNode = DependencyManager::get<NodeList>()->nodeWithUUID(nodeUUID);
// If the node no longer exists, wait until the ReceivedPacketProcessor has cleaned up the node
// to remove it from our stats list.
// FIXME Is it safe to clean it up here before ReceivedPacketProcess has?
if (!destinationNode) {
continue;
}
// retrieve sequence number stats of node, prune its missing set
SequenceNumberStats& sequenceNumberStats = nodeStats.getIncomingEditSequenceNumberStats();

View file

@ -13,6 +13,8 @@
using namespace udt;
static int packetMetaTypeId = qRegisterMetaType<Packet*>("Packet*");
int Packet::localHeaderSize(bool isPartOfMessage) {
return sizeof(Packet::SequenceNumberAndBitField) +
(isPartOfMessage ? sizeof(Packet::MessageNumberAndBitField) + sizeof(MessagePartNumber) : 0);

View file

@ -88,7 +88,9 @@ private:
mutable PacketPosition _packetPosition { PacketPosition::ONLY };
mutable MessagePartNumber _messagePartNumber { 0 };
};
} // namespace udt
Q_DECLARE_METATYPE(udt::Packet*);
#endif // hifi_Packet_h

View file

@ -15,6 +15,8 @@
using namespace udt;
static int packetListMetaTypeId = qRegisterMetaType<PacketList*>("PacketList*");
std::unique_ptr<PacketList> PacketList::create(PacketType packetType, QByteArray extendedHeader,
bool isReliable, bool isOrdered) {
auto packetList = std::unique_ptr<PacketList>(new PacketList(packetType, extendedHeader,

View file

@ -118,4 +118,6 @@ template<typename T> std::unique_ptr<T> PacketList::takeFront() {
}
Q_DECLARE_METATYPE(udt::PacketList*);
#endif // hifi_PacketList_h

View file

@ -24,16 +24,10 @@
using namespace udt;
Q_DECLARE_METATYPE(Packet*);
Q_DECLARE_METATYPE(PacketList*);
Socket::Socket(QObject* parent) :
QObject(parent),
_synTimer(new QTimer(this))
{
qRegisterMetaType<Packet*>("Packet*");
qRegisterMetaType<PacketList*>("PacketList*");
connect(&_udpSocket, &QUdpSocket::readyRead, this, &Socket::readPendingDatagrams);
// make sure our synchronization method is called every SYN interval