From 58a852ff46f5e14b5b9ddf91e9fd5d7f0cef4527 Mon Sep 17 00:00:00 2001 From: Ivan Mahonin Date: Oct 26 2021 07:18:43 +0000 Subject: additional debug --- diff --git a/udprecvqueue.cpp b/udprecvqueue.cpp index b312c32..6799944 100644 --- a/udprecvqueue.cpp +++ b/udprecvqueue.cpp @@ -30,15 +30,27 @@ UdpRecvQueue::~UdpRecvQueue() bool UdpRecvQueue::recvUdp(unsigned int index, const void *data, int size) { confirmRequired = true; - if (size < 0 || size > PACKET_SIZE) + if (size < 0 || size > PACKET_SIZE) { + DebugMsg("%u, %u, %d bad size", connection.id.id, index, size); return false; - if (cycleLess(index, currentIndex) || !cycleLess(index, currentIndex + PACKETS_COUNT)) + } + if (cycleLess(index, currentIndex)) { + DebugMsg("%u, %u, %d already received and processed", connection.id.id, index, size); + return false; + } + if (!cycleLess(index, currentIndex + PACKETS_COUNT)) { + DebugMsg("%u, %u, %d index is outside from reserved buffer space", connection.id.id, index, size); return false; - if (finalEntryAdded && !cycleLess(index, endIndex)) + } + if (finalEntryAdded && !cycleLess(index, endIndex)) { + DebugMsg("%u, %u, %d behind the last", connection.id.id, index, size); return false; + } Entry &e = entries[(current + (index - currentIndex))%PACKETS_COUNT]; - if (e.received) + if (e.received) { + DebugMsg("%u, %u, %d already received", connection.id.id, index, size); return false; + } DebugMsg("%u, %u, %d", connection.id.id, index, size); e.received = true;