My application uses jsch to do port-forwarding.
When I'm done in my client I send a, two-part hdr+body style,
"goodbye" message, close the socket, disconnect the channel and
disconnect the session.
The problem is that on the server side the "goodbye" message sometimes
doesn't arrive, or only the hdr arrives. Instead the read() fails
on a closed socket.
It's clear that disconnecting the session doesn't provide for
any draining so it might bring things down before the "goodbye"
message has made it's way through through the snake.
But is this a bug or a feature?
I've also observed that if _I don't_ disconnect the session
that Session.run() will eventually pop out of it's main loop
and call disconnect().
In fact until jsch-0.1.40 there was a bug where my
call to disconnect() would race the call from
Session.run() causing NPE's on connectThread).
However, occasionally the loop in Session.run() hangs around
and keeps my application from exiting. I figured that somehow
either the closing of the socket or the channel will directly
or indirectly shut down the Session.run() loop. What I
observed is that the loop is exited due to a IOEception on it's
main read.
Considering the general rule that exceptions should be used for
exceptional conditions and not control flow, is this by design?
The "intended design" seems to be clients calling disconnect
because of the while test case at the top of Session.run ...
The condition it tests turns false on a disconnect.
Ergo, I should disconnect my own session.
But this brings me back to the dropped "goodby" message.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
JSch-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users