Enforce idleTimeout/heartbeatInterval consistency 56/104656/1
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 1 Mar 2023 12:40:22 +0000 (13:40 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 1 Mar 2023 12:41:36 +0000 (13:41 +0100)
We should not allow a configuration where we time out before we send a
heartbeat. Enforce this invariant.

JIRA: NETCONF-970
Change-Id: Ic26319d7a3da4db9b28fa0aa2e39cdfe439fd786
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/streams/StreamsConfiguration.java

index 6a10286bfa2fd5a141f1c7bd25f04231c8f15dec..95af24a110672b0ac4f12b889e984c11a8f200ce 100644 (file)
@@ -29,5 +29,7 @@ public record StreamsConfiguration(int maximumFragmentLength, int idleTimeout, i
         checkArgument(idleTimeout > 0, "Idle timeout must be specified by positive value.");
         checkArgument(heartbeatInterval >= 0,
             "Heartbeat ping interval must be disabled (0) or specified by positive value.");
+        // we need at least one heartbeat before we time out the socket
+        checkArgument(idleTimeout > heartbeatInterval, "Idle timeout must be greater than heartbeat ping interval.");
     }
 }
\ No newline at end of file