Hello,

I am attempting to implement a timeout using session.connect(30000).  If a
user adds the wrong credentials, I want the connection to return an auth
fail JschException however, it seems to be ignoring this and finally returns
the exception after many minutes.

Part of my testcase looks like this:

<code>
 try {
            System.out.println("attempting to connect");
            session.connect(30000);
            success = true;
            System.out.println("successfully connected");

        } catch(JSchException e) {
            System.out.println("exception here... can be a bad login or
connection failure");
            e.printStackTrace();
            long endTime = System.currentTimeMillis();
            System.out.println("exception occurred after: " + (endTime -
startTime) + " ms");

        }

        assert(success);

</code>

When the exception is finally caught, almost 5 minutes have passed.  If I
lower the timeout to session.connect(30), it immediately comes back in 57
milliseconds, session.connect(300) comes back in 1294 ms,
session.connect(3000) which should only be 3 sec. takes just as long as
session.connect(30000).

Has anyone had similar problems such as this?  Currently I have to wrap the
connect method in my own thread that uses a Timer to keep track of my
timeout...
------------------------------------------------------------------------------
_______________________________________________
JSch-users mailing list
JSch-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to