Hi

First - thanks for the great work on JSch - real industrial quality
code that has dug me out of a hole on a couple of projects.

On my current project I want to use the ability to make an ssh
connection to tell me when a server has booted. So I want to block
until a connection is established, but let the user cancel.

In order to achieve this I sit in a loop with a relatively quick timeout.

        while (true) {
            if (Thread.interrupted())
                throw new InterruptedIOException();
            try {
                session.connect(1000);
                return;
            } catch (JschException x) {
                // on timeout or other error
            }
        }

The problem is that Util.createSocket at 374 catches
InterruptedException and does not re-interrupt the thread with
Thread.interrupt(), so the status is lost and I can't tell whether the
exception is caused by the interruption or the machine not being up.

I know that I could use another flag, but the interrupted status of
the thread is made for this case. Could I suggest this minor change

diff Util.java CopyOfUtil.java
375d374
<         Thread.currentThread().interrupt();

Thanks again

Duncan McGregor

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
JSch-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to