Skip to content

Commit

Permalink
Properly handle the depth increase and decrease
Browse files Browse the repository at this point in the history
  • Loading branch information
lhotari committed Feb 3, 2024
1 parent a751294 commit 5f8fef5
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ public void visitBuffer(InternalContext<T> internalContext, ByteBuf visitBuffer,
internalContext.userCallback.visitBuffer(internalContext.userContext, visitBuffer,
visitIndex, visitLength);
} else {
internalContext.depth++;
// use the doRecursivelyVisitBuffers method to visit the wrapped buffer, possibly recursively
doRecursivelyVisitBuffers(visitBuffer, visitIndex, visitLength, this, internalContext);
}
Expand Down Expand Up @@ -152,7 +151,9 @@ private static <T> void doRecursivelyVisitBuffers(ByteBuf buffer, int offset, in
internalContext.parentBuffer = buffer;
internalContext.parentOffset = offset;
internalContext.parentLength = length;
internalContext.depth++;
visitBuffersImpl(buffer, offset, length, callback, internalContext);
internalContext.depth--;
} else {
// visit the buffer
internalContext.userCallback.visitBuffer(internalContext.userContext, buffer, offset, length);
Expand Down

0 comments on commit 5f8fef5

Please sign in to comment.