I read in the FAQ: " MINA doesn't close any connections unless you called
IoSession.close()", so maybe my question should be: How do I get the
IoSession when implementing a Command?

Cheers,
Reto

On Mon, Dec 27, 2010 at 4:02 PM, Reto Bachmann-Gmuer <[email protected]>wrote:

> Hello
>
> I'm connection sshd to my shell service by doing
>
> sshd.setShellFactory(new Factory<Command>() {
>
>             @Override
>             public Command create() {
>
>                 return new Command() {
>
>                     @Override
>                     public void start(Environment e) throws IOException {
>                                     shell = shellFactory.createShell(in,
> out);
>                                     shell.addTerminationListener(new
> Shell.TerminationListener() {
>                                         public void terminated() {
>                                             try {
>                                                 log.info("closing ssh
> stream");
>                                                 out.close();
>                                                 in.close();
>                                             } catch (IOException ex) {
>                                                 log.warn("error closing ssh
> stream", ex);
>                                             }
>                                         };
>                                     });
>                                     shell.start();
>                     }
>
>
> Unfortunately closing in and out doesn't close the connection instantly,
> only when the user of the ssh client presses a character I get a
> "java.io.IOException: Pipe closed" and the connection is closed.
>
> What's the right way to close the connection to a client?
>
> Cheers,
> Reto
>

Reply via email to