Skip to content

Commit

Permalink
keep alive interval need to be set before the connection is open
Browse files Browse the repository at this point in the history
  • Loading branch information
ltamaster committed Jan 3, 2024
1 parent 398fa9b commit e2d99b1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/java/com/plugin/sshjplugin/model/SSHJBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ public void connect(SSHClient ssh){
retryCount=0;
}

if (keepAliveInterval != 0) {
ssh.getConnection().getKeepAlive().setKeepAliveInterval(keepAliveInterval);
}

while(count <= retryCount) {
try {
pluginLogger.log(3, "["+getPluginName()+"] open connection");
Expand All @@ -107,10 +111,6 @@ public void connect(SSHClient ssh){

authentication.authenticate(ssh);

if (keepAliveInterval != 0) {
ssh.getConnection().getKeepAlive().setKeepAliveInterval(keepAliveInterval); //every 60sec
}

pluginLogger.log(3, "["+getPluginName()+"] authentication set");


Expand Down

0 comments on commit e2d99b1

Please sign in to comment.