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 4e102683ae5ea8f814ee7079cfa164767af22223 Author: Thomas Wolf <tw...@apache.org> AuthorDate: Sat Apr 5 19:56:55 2025 +0200 Drop SessionListener.sessionEstablished() This event was rather useless anyway because it was emitted while the Session object was still being constructed; i.e., not fully initialized. Users should use either the sessionCreated() or the sessionStarting() callback. --- .../session/EndlessTarpitSenderSupportDevelopment.java | 4 ++-- .../java/org/apache/sshd/common/session/SessionListener.java | 12 ------------ .../apache/sshd/common/session/helpers/AbstractSession.java | 8 -------- .../apache/sshd/common/session/helpers/SessionHelper.java | 4 ---- 4 files changed, 2 insertions(+), 26 deletions(-) diff --git a/sshd-contrib/src/test/java/org/apache/sshd/contrib/server/session/EndlessTarpitSenderSupportDevelopment.java b/sshd-contrib/src/test/java/org/apache/sshd/contrib/server/session/EndlessTarpitSenderSupportDevelopment.java index fa35b8482..0d20f7b27 100644 --- a/sshd-contrib/src/test/java/org/apache/sshd/contrib/server/session/EndlessTarpitSenderSupportDevelopment.java +++ b/sshd-contrib/src/test/java/org/apache/sshd/contrib/server/session/EndlessTarpitSenderSupportDevelopment.java @@ -238,8 +238,8 @@ public final class EndlessTarpitSenderSupportDevelopment extends AbstractLogging private final AtomicInteger lastCount = new AtomicInteger(); @Override - public void sessionEstablished(Session session) { - log.info("sessionEstablished({})", session); + public void sessionStarting(Session session) { + log.info("sessionStarting({})", session); } @Override diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/SessionListener.java b/sshd-core/src/main/java/org/apache/sshd/common/session/SessionListener.java index e652aaa33..fbcd4f08d 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/session/SessionListener.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/session/SessionListener.java @@ -50,18 +50,6 @@ public interface SessionListener extends SshdEventListener { KexCompleted } - /** - * An initial session connection has been established - <B>Caveat emptor:</B> the main difference between this - * callback and {@link #sessionCreated(Session)} is that when this callback is called, the session is not yet fully - * initialized so not all API(s) will respond as expected. The main purpose of this callback is to allow the user to - * customize some session properties based on the peer's address and/or any provided connection context. - * - * @param session The established {@code Session} - */ - default void sessionEstablished(Session session) { - // ignored - } - /** * A new session just been created. The event is emitted before the session is started. The session's filter chain * is not yet set up. diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java index f3a33ef7d..d3e579be0 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java @@ -203,14 +203,6 @@ public abstract class AbstractSession extends SessionHelper { ChannelListener.class, channelListeners); tunnelListenerProxy = EventListenerUtils.proxyWrapper( PortForwardingEventListener.class, tunnelListeners); - - try { - signalSessionEstablished(ioSession); - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { - throw new RuntimeSshException(e); - } } /** diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/SessionHelper.java b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/SessionHelper.java index 2b8e73467..22c40c021 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/SessionHelper.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/SessionHelper.java @@ -549,10 +549,6 @@ public abstract class SessionHelper extends AbstractKexFactoryManager implements return writePacket(buffer); } - protected void signalSessionEstablished(IoSession ioSession) throws Exception { - callSignaller("established", l -> l.sessionEstablished(this)); - } - protected void signalSessionCreated(IoSession ioSession) throws Exception { callSignaller("created", l -> l.sessionCreated(this)); }