edits
[iotcloud.git] / version2 / src / C / SlotBuffer.cc
index de4bbe0bc64a43f14851d46b2eb401dbeacbc409..248abd78017f03237e0f74cd8cf5bfc8403ad962 100644 (file)
@@ -13,6 +13,10 @@ SlotBuffer::SlotBuffer() :
        oldestseqn(0) {
 }
 
+SlotBuffer::~SlotBuffer() {
+       delete array;
+}
+
 int SlotBuffer::size() {
        if (head >= tail)
                return head - tail;
@@ -56,7 +60,6 @@ void SlotBuffer::putSlot(Slot *s) {
        int64_t checkNum = (getNewestSeqNum() + 1);
 
        if (checkNum != s->getSequenceNumber()) {
-               // We have a gap so expunge all our slots
                oldestseqn = s->getSequenceNumber();
                tail = 0;
                head = 1;
@@ -82,7 +85,6 @@ Slot *SlotBuffer::getSlot(int64_t seqnum) {
        int32_t index = diff + tail;
 
        if (index < 0) {
-               // Really old message so we dont have it anymore
                return NULL;
        }
 
@@ -94,9 +96,9 @@ Slot *SlotBuffer::getSlot(int64_t seqnum) {
        }
 
        if (index >= array->length()) {
-
                return NULL;
        }
+
        if (head >= tail && index >= head) {
                return NULL;
        }