Do not propagate empty writes 79/108379/2
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 12 Oct 2023 20:26:30 +0000 (22:26 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 12 Oct 2023 20:43:16 +0000 (22:43 +0200)
The API contract says we can see 0-sized events. Do not propagate those,
as they are not changing channel state.

JIRA: NETCONF-1106
Change-Id: I5dab0bca2616627833409eb82da733bec87cc1a4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
protocol/netconf-server/src/main/java/org/opendaylight/netconf/server/NetconfSubsystem.java

index 7571b7130067352bcc52d06a125a81194cb60efa..a94cbe63051e8fe5c8a04a0e4bda3e768cde3699 100644 (file)
@@ -89,7 +89,10 @@ final class NetconfSubsystem extends AbstractCommandSupport
 
     @Override
     public int data(final ChannelSession channel, final byte[] buf, final int start, final int len) {
-        innerChannel.writeInbound(Unpooled.copiedBuffer(buf, start, len));
+        // Do not propagate empty invocations
+        if (len != 0) {
+            innerChannel.writeInbound(Unpooled.copiedBuffer(buf, start, len));
+        }
         return len;
     }