This is an automated email from the ASF dual-hosted git repository.

twolf pushed a commit to branch dev_3.0
in repository https://gitbox.apache.org/repos/asf/mina-sshd.git

commit e834655d746e228bbb0faaa84122179ca9a85a64
Author: Thomas Wolf <tw...@apache.org>
AuthorDate: Wed Apr 9 22:53:58 2025 +0200

    Remove deprecated CoreModuleProperties
---
 .../client/config/SshClientConfigFileReader.java   | 16 ++++-----
 .../client/session/ClientConnectionService.java    | 39 +---------------------
 .../org/apache/sshd/core/CoreModuleProperties.java | 19 -----------
 3 files changed, 9 insertions(+), 65 deletions(-)

diff --git 
a/sshd-core/src/main/java/org/apache/sshd/client/config/SshClientConfigFileReader.java
 
b/sshd-core/src/main/java/org/apache/sshd/client/config/SshClientConfigFileReader.java
index 24878ea92..80f310396 100644
--- 
a/sshd-core/src/main/java/org/apache/sshd/client/config/SshClientConfigFileReader.java
+++ 
b/sshd-core/src/main/java/org/apache/sshd/client/config/SshClientConfigFileReader.java
@@ -42,13 +42,13 @@ public final class SshClientConfigFileReader {
     public static final String REQUEST_TTY_OPTION = "RequestTTY";
 
     public static final Property<Duration> CLIENT_LIVECHECK_INTERVAL_PROP
-            = Property.duration("ClientAliveInterval", Duration.ZERO);
+            = Property.duration("ServerAliveInterval", Duration.ZERO);
 
-    public static final Property<Boolean> CLIENT_LIVECHECK_USE_NULLS = 
Property.bool("ClientAliveUseNullPackets", false);
+    public static final Property<Boolean> CLIENT_LIVECHECK_USE_NULLS = 
Property.bool("ServerAliveUseNullPackets", false);
 
-    public static final Property<Duration> CLIENT_LIVECHECK_REPLIES_WAIT
-            = Property.duration("ClientAliveReplyWait", Duration.ZERO);
-    public static final long DEFAULT_LIVECHECK_REPLY_WAIT = 0L;
+    public static final int DEFAULT_LIVECHECK_MISSED_REPLIES_MAX = 3;
+    public static final Property<Integer> CLIENT_LIVECHECK_MISSED_REPLIES_MAX 
= Property.integer("ServerAliveCountMax",
+            DEFAULT_LIVECHECK_MISSED_REPLIES_MAX);
 
     private SshClientConfigFileReader() {
         throw new UnsupportedOperationException("No instance allowed");
@@ -64,15 +64,15 @@ public final class SshClientConfigFileReader {
             return client;
         }
 
-        if (CLIENT_LIVECHECK_USE_NULLS.getRequired(props)) {
+        if (CLIENT_LIVECHECK_USE_NULLS.getRequired(props).booleanValue()) {
             CommonModuleProperties.SESSION_HEARTBEAT_TYPE.set(client, 
HeartbeatType.IGNORE);
             CommonModuleProperties.SESSION_HEARTBEAT_INTERVAL.set(client, 
interval);
         } else {
             CoreModuleProperties.HEARTBEAT_INTERVAL.set(client, interval);
 
-            interval = CLIENT_LIVECHECK_REPLIES_WAIT.getRequired(props);
+            int n = CLIENT_LIVECHECK_MISSED_REPLIES_MAX.getRequired(props);
             if (!GenericUtils.isNegativeOrNull(interval)) {
-                CoreModuleProperties.HEARTBEAT_REPLY_WAIT.set(client, 
interval);
+                CoreModuleProperties.HEARTBEAT_NO_REPLY_MAX.set(client, n);
             }
         }
 
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionService.java
 
b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionService.java
index 42874718f..db38a93df 100644
--- 
a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionService.java
+++ 
b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientConnectionService.java
@@ -61,44 +61,7 @@ public class ClientConnectionService
 
         heartbeatRequest = 
CoreModuleProperties.HEARTBEAT_REQUEST.getRequired(this);
         heartbeatInterval = 
CoreModuleProperties.HEARTBEAT_INTERVAL.getRequired(this);
-        heartbeatMaxNoReply = configureMaxNoReply();
-    }
-
-    protected int configureMaxNoReply() {
-        @SuppressWarnings("deprecation")
-        Duration timeout = 
CoreModuleProperties.HEARTBEAT_REPLY_WAIT.getOrNull(this);
-        if (timeout == null || 
GenericUtils.isNegativeOrNull(heartbeatInterval) || 
GenericUtils.isEmpty(heartbeatRequest)) {
-            return 
CoreModuleProperties.HEARTBEAT_NO_REPLY_MAX.getRequired(this).intValue();
-        }
-        // The deprecated timeout is configured explicitly. If the new 
no-reply-max is _not_ explicitly configured,
-        // set it from the timeout.
-        Integer noReplyValue = 
CoreModuleProperties.HEARTBEAT_NO_REPLY_MAX.getOrNull(this);
-        if (noReplyValue != null) {
-            return noReplyValue.intValue();
-        }
-        if (GenericUtils.isNegativeOrNull(timeout)) {
-            return 0;
-        }
-        if (timeout.compareTo(heartbeatInterval) >= 0) {
-            // Timeout is longer than the interval. With the previous system, 
that would have killed the session when
-            // the timeout was reached. A slow server that managed to return 
the reply just before the timeout expired
-            // would have delayed subsequent heartbeats. The new system will 
keep sending heartbeats with the given
-            // interval. Thus we can have timeout / interval heartbeats 
without reply if we want to approximate the
-            // timeout.
-            double timeoutSec = timeout.getSeconds() + (timeout.getNano() / 
1_000_000_000.0);
-            double intervalSec = heartbeatInterval.getSeconds() + 
(heartbeatInterval.getNano() / 1_000_000_000.0);
-            double multiple = timeoutSec / intervalSec;
-            if (multiple >= Integer.MAX_VALUE - 1) {
-                return Integer.MAX_VALUE;
-            } else {
-                return (int) multiple + 1;
-            }
-        }
-        // Timeout is smaller than the interval. We want to have every 
heartbeat replied to.
-        return 1;
-        // This is an approximation. If no reply is forthcoming, the session 
will be killed after the interval. In the
-        // previous system, it would have been killed after the timeout. We 
_could_ code something to schedule a task
-        // that kills the session after the timeout and cancel that if we get 
a reply, but it seems a bit pointless.
+        heartbeatMaxNoReply = 
CoreModuleProperties.HEARTBEAT_NO_REPLY_MAX.getRequired(this).intValue();
     }
 
     @Override
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/core/CoreModuleProperties.java 
b/sshd-core/src/main/java/org/apache/sshd/core/CoreModuleProperties.java
index 546447dab..eaee6459f 100644
--- a/sshd-core/src/main/java/org/apache/sshd/core/CoreModuleProperties.java
+++ b/sshd-core/src/main/java/org/apache/sshd/core/CoreModuleProperties.java
@@ -137,15 +137,6 @@ public final class CoreModuleProperties {
     public static final Property<Boolean> ALLOW_DHG1_KEX_FALLBACK
             = Property.bool("allow-dhg1-kex-fallback", false);
 
-    /**
-     * Unused.
-     *
-     * @deprecated since 2.14.0
-     */
-    @Deprecated
-    public static final Property<Duration> KEX_PROPOSAL_SETUP_TIMEOUT
-            = Property.duration("kex-proposal-setup-timeout", Duration.ZERO);
-
     /**
      * Key used to set the heartbeat interval in milliseconds (0 to disable = 
default)
      */
@@ -158,16 +149,6 @@ public final class CoreModuleProperties {
     public static final Property<String> HEARTBEAT_REQUEST
             = Property.string("heartbeat-request", 
"keepal...@sshd.apache.org");
 
-    /**
-     * Key used to indicate that the heartbeat request is also expecting a 
reply - time in <U>milliseconds</U> to wait
-     * for the reply. If non-positive then no reply is expected (nor 
requested).
-     *
-     * @deprecated since 2.13.0, use {@link #HEARTBEAT_NO_REPLY_MAX} instead
-     */
-    @Deprecated
-    public static final Property<Duration> HEARTBEAT_REPLY_WAIT
-            = Property.durationSec("heartbeat-reply-wait", 
Duration.ofMinutes(5));
-
     /**
      * Key to set the maximum number of heartbeat messages to send without 
having received a reply. If &gt; 0, heartbeat
      * messages are sent with a flag that requires the peer to reply. The 
session will be killed if

Reply via email to