Commit fc300807 authored by Florian Fittkau's avatar Florian Fittkau

fixed missing clear after trace chunk reading

parent db122355
......@@ -358,37 +358,7 @@ class TCPReaderOneClient extends Thread {
if (buffer.remaining() >= 1) {
final byte clazzId = buffer.get();
if (clazzId == (byte) 0) {
if (buffer.remaining() >= (4 + 4)) {
int recordAmountNowComming = buffer.getInt();
final int bytesComming = buffer.getInt();
if (buffer.remaining() >= bytesComming) {
while (recordAmountNowComming > 0) {
try {
currentlyOpenTrace.getTraceEvents().add(
AbstractEventRecord.createFromByteBuffer(buffer,
stringRegistry));
} catch (final IdNotAvailableException e) {
// should not happen
e.printStackTrace();
}
recordAmountNowComming--;
}
if (currentlyOpenTrace.getTraceEvents().size() == currentlyOpenTrace
.getEventsLength()) {
putInQueue(currentlyOpenTrace);
currentlyOpenTrace = null;
return true;
}
} else {
buffer.position(buffer.position() - 4 - 4 - 1);
buffer.compact();
return false;
}
}
} else if (clazzId == StringRegistryRecord.CLAZZ_ID) {
if (clazzId == StringRegistryRecord.CLAZZ_ID) {
int mapId = 0;
int stringLength = 0;
if (buffer.remaining() >= 8) {
......@@ -408,10 +378,48 @@ class TCPReaderOneClient extends Thread {
stringRegistry.putStringRecord(mapId, new String(stringByteArray));
checkWaitingMessages();
boolean cleared = false;
if (buffer.remaining() == 0) {
buffer.clear();
cleared = true;
}
return !cleared;
} else {
buffer.position(buffer.position() - 9);
buffer.compact();
return false;
}
} else if (buffer.remaining() >= (4 + 4)) {
int recordAmountNowComming = buffer.getInt();
final int bytesComming = buffer.getInt();
if (buffer.remaining() >= bytesComming) {
while (recordAmountNowComming > 0) {
try {
final AbstractEventRecord fromByteBuffer = AbstractEventRecord
.createFromByteBuffer(buffer, stringRegistry);
currentlyOpenTrace.getTraceEvents().add(fromByteBuffer);
} catch (final IdNotAvailableException e) {
// should not happen
e.printStackTrace();
}
recordAmountNowComming--;
}
boolean cleared = false;
if (buffer.remaining() == 0) {
buffer.clear();
cleared = true;
}
if (currentlyOpenTrace.getTraceEvents().size() == currentlyOpenTrace
.getEventsLength()) {
putInQueue(currentlyOpenTrace);
currentlyOpenTrace = null;
return !cleared;
}
} else {
buffer.position(buffer.position() - 4 - 4 - 1);
buffer.compact();
}
}
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment