You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "MayDay (JIRA)" <ji...@apache.org> on 2017/10/26 09:11:00 UTC

[jira] [Updated] (SSHD-781) The heartbeat task of client not support keepalive function well

     [ https://issues.apache.org/jira/browse/SSHD-781?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

MayDay updated SSHD-781:
------------------------
    Summary: The heartbeat task of client not support keepalive function well  (was: Fail to run the heartbeat task.)

> The heartbeat task of client not support keepalive function well
> ----------------------------------------------------------------
>
>                 Key: SSHD-781
>                 URL: https://issues.apache.org/jira/browse/SSHD-781
>             Project: MINA SSHD
>          Issue Type: Question
>    Affects Versions: 1.4.0
>         Environment: Any environment
>            Reporter: MayDay
>
>  
>         The heartbeat request of sshClient is SSH_MSG_GLOBAL_REQUEST, but the default buffer of heartbeat set false (see ClientConnectService#sendHeartbeat )
> {code:java}
> buf.putBoolean(false);
> {code}
>         The sshServer reponse the heartbeat by the KeepAliveHandler, then sendGlobalResponse. but if the buffer of heartbeat set false, then the sendGlobalResponse will not reponse sshClient.(see AbstractConnectionService #globalRequest)
> {code:java}
> boolean wantReply = buffer.getBoolean();
> {code}
> {code:java}
>     protected IoWriteFuture sendGlobalResponse(Buffer buffer, String req, RequestHandler.Result result, boolean wantReply) throws IOException {
>         if (log.isDebugEnabled()) {
>             log.debug("sendGlobalResponse({})[{}] result={}, want-reply={}", this, req, result, wantReply);
>         }
>         if (RequestHandler.Result.Replied.equals(result) || (!wantReply)) {
>             return new AbstractIoWriteFuture(req, null) {
>                 {
>                     setValue(Boolean.TRUE);
>                 }
>             };
>         }
>         byte cmd = RequestHandler.Result.ReplySuccess.equals(result)
>                  ? SshConstants.SSH_MSG_REQUEST_SUCCESS
>                  : SshConstants.SSH_MSG_REQUEST_FAILURE;
>         Session session = getSession();
>         Buffer rsp = session.createBuffer(cmd, 2);
>         return session.writePacket(rsp);
> }
> {code}
> 1 、if it a Bug? how the sshClient know the server is available when the server don't response.
> I have test it whth create a client with params (
>  HEARTBEAT_INTERAL = 60
>  IDLE_TIMEOUT = 300
>  NIO_READ_TIMEOUT = 315)and a server, and the client will close seesion after the NIO_READ_TIMEOUT.
>          



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)