From: Mathieu Desnoyers Date: Thu, 23 Apr 2020 16:51:40 +0000 (-0400) Subject: Fix: agent: read: end of loop condition should exclude 0 X-Git-Tag: v2.13.0-rc1~503 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=dcd9a9d798f85ccee281d66f85ff4a9b5520a088;p=lttng-ust.git Fix: agent: read: end of loop condition should exclude 0 Causes the agent to hang endlessly waiting for completion of the loop. Signed-off-by: Mathieu Desnoyers --- diff --git a/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/LttngTcpSessiondClient.java b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/LttngTcpSessiondClient.java index 0e7a5c18..c6385005 100644 --- a/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/LttngTcpSessiondClient.java +++ b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/LttngTcpSessiondClient.java @@ -387,7 +387,7 @@ public class LttngTcpSessiondClient implements Runnable { int bytesLeft = data.length; int bytesOffset = 0; - while (bytesLeft >= 0) { + while (bytesLeft > 0) { int bytesRead = this.inFromSessiond.read(data, bytesOffset, bytesLeft); if (bytesRead < 0) { @@ -416,7 +416,7 @@ public class LttngTcpSessiondClient implements Runnable { return null; } - while (bytesLeft >= 0) { + while (bytesLeft > 0) { int bytesRead = inFromSessiond.read(payload, bytesOffset, bytesLeft); if (bytesRead < 0) {