Clean up SSH server subsystem handling
[netconf.git] / transport / transport-ssh / src / main / java / org / opendaylight / netconf / transport / ssh / TransportClientSession.java
1 /*
2  * Copyright (c) 2023 PANTHEON.tech, s.r.o. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.netconf.transport.ssh;
9
10 import java.io.IOException;
11 import org.opendaylight.netconf.shaded.sshd.client.session.ClientSessionImpl;
12 import org.opendaylight.netconf.shaded.sshd.common.io.IoSession;
13
14 /**
15  * Our own version of {@link ClientSessionImpl}, bound to a backend Netty channel.
16  */
17 final class TransportClientSession extends ClientSessionImpl {
18     TransportClientSession(final TransportSshClient client, final IoSession ioSession) throws Exception {
19         super(client, ioSession);
20     }
21
22     @Override
23     public TransportClientSubsystem createSubsystemChannel(final String subsystem) throws IOException {
24         final var channel = new TransportClientSubsystem(subsystem);
25         final var service = getConnectionService();
26         final var id = service.registerChannel(channel);
27         if (log.isDebugEnabled()) {
28             log.debug("createSubsystemChannel({})[{}] created id={}", this, subsystem, id);
29         }
30         return channel;
31     }
32 }