projects
/
iotcloud.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
edits
[iotcloud.git]
/
version2
/
src
/
C
/
SlotBuffer.cc
diff --git
a/version2/src/C/SlotBuffer.cc
b/version2/src/C/SlotBuffer.cc
index de4bbe0bc64a43f14851d46b2eb401dbeacbc409..248abd78017f03237e0f74cd8cf5bfc8403ad962 100644
(file)
--- a/
version2/src/C/SlotBuffer.cc
+++ b/
version2/src/C/SlotBuffer.cc
@@
-13,6
+13,10
@@
SlotBuffer::SlotBuffer() :
oldestseqn(0) {
}
oldestseqn(0) {
}
+SlotBuffer::~SlotBuffer() {
+ delete array;
+}
+
int SlotBuffer::size() {
if (head >= tail)
return head - tail;
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()) {
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;
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) {
int32_t index = diff + tail;
if (index < 0) {
- // Really old message so we dont have it anymore
return NULL;
}
return NULL;
}
@@
-94,9
+96,9
@@
Slot *SlotBuffer::getSlot(int64_t seqnum) {
}
if (index >= array->length()) {
}
if (index >= array->length()) {
-
return NULL;
}
return NULL;
}
+
if (head >= tail && index >= head) {
return NULL;
}
if (head >= tail && index >= head) {
return NULL;
}