[ 
https://issues.apache.org/jira/browse/SSHD-780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16220042#comment-16220042
 ] 

MayDay edited comment on SSHD-780 at 10/26/17 6:59 AM:
-------------------------------------------------------

If the server is out of my control,how to make the heartbeat( which send a 
request and don't wait for the reponse) useful.

And the default heartbeat buffer is {color:#205081}false {color}(see 
{code:java}ClientConnectionService#sendHeartbeat{code}).

 Accoding the {color:#205081}rfc4254{color}, The recipient will respond to this 
message with   SSH_MSG_REQUEST_SUCCESS or SSH_MSG_REQUEST_FAILURE if 'want 
reply' is   {color:#205081}TRUE{color}.     Is it a bug?


{code:java}
    protected IoWriteFuture sendHeartBeat() {
        ClientSession session = getClientSession();
        String request = 
session.getStringProperty(ClientFactoryManager.HEARTBEAT_REQUEST, 
ClientFactoryManager.DEFAULT_KEEP_ALIVE_HEARTBEAT_STRING);
        try {
            Buffer buf = 
session.createBuffer(SshConstants.SSH_MSG_GLOBAL_REQUEST, request.length() + 
Byte.SIZE);
            buf.putString(request);
         {color:#205081}{color:#654982}   buf.putBoolean(false);{color}{color}
            return session.writePacket(buf);
        } catch (IOException e) {
            if (log.isDebugEnabled()) {
                log.debug("Error (" + e.getClass().getSimpleName() + ") sending 
keepalive message=" + request + ": " + e.getMessage());
            }

            Throwable t = e;
            return new AbstractIoWriteFuture(request, null) {
                {
                    setValue(t);
                }
            };
        }
}
{code}






was (Author: mayday):
If the server is out of my control,how to make the heartbeat( which send a 
request and don't wait for the reponse) useful.

And the default heartbeat buffer is {color:#205081}false {color}(see 
{code:java}ClientConnectionService#sendHeartbeat{code}).

 Accoding the {color:#205081}rfc4254{color}, The recipient will respond to this 
message with   SSH_MSG_REQUEST_SUCCESS or SSH_MSG_REQUEST_FAILURE if 'want 
reply' is   {color:#205081}TRUE{color}. Is it a bug?




> How does the HeartBeat work?
> ----------------------------
>
>                 Key: SSHD-780
>                 URL: https://issues.apache.org/jira/browse/SSHD-780
>             Project: MINA SSHD
>          Issue Type: Question
>    Affects Versions: 1.4.0
>         Environment: jdk1.8.0
>            Reporter: MayDay
>
> How does the HeartBeat work?
> it only send keepAlive every interal time,but not to check the reply of the 
> keepAlive timeout.
> how does the client know that the server is available.
> Or does other param need to set to make the client heartbeat work?



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

Reply via email to