@@ -154,6 +154,7 @@ Ingenonsya France | |||||
Ingmar Stein | Ingmar Stein | ||||
Irene Rusman | Irene Rusman | ||||
Isaac Shabtay | Isaac Shabtay | ||||
Issa Gorissen | |||||
Ivan Ivanov | Ivan Ivanov | ||||
J Bleijenbergh | J Bleijenbergh | ||||
Jack J. Woehr | Jack J. Woehr | ||||
@@ -95,6 +95,11 @@ Other changes: | |||||
* <javac> now supports Java9 modules. | * <javac> now supports Java9 modules. | ||||
https://github.com/apache/ant/pull/16 | https://github.com/apache/ant/pull/16 | ||||
* <sshexec> and <scp> have two new attributes serverAliveInterval and | |||||
serverAliveCountMax that can be used to keep a intermediaries from | |||||
closing idle connections. | |||||
Bugzilla Report 59162 | |||||
Changes from Ant 1.9.5 TO Ant 1.9.6 | Changes from Ant 1.9.5 TO Ant 1.9.6 | ||||
=================================== | =================================== | ||||
@@ -640,6 +640,10 @@ | |||||
<first>Isaac</first> | <first>Isaac</first> | ||||
<last>Shabtay</last> | <last>Shabtay</last> | ||||
</name> | </name> | ||||
<name> | |||||
<first>Issa</first> | |||||
<last>Gorissen</last> | |||||
</name> | |||||
<name> | <name> | ||||
<first>Ivan</first> | <first>Ivan</first> | ||||
<last>Ivanov</last> | <last>Ivanov</last> | ||||
@@ -200,6 +200,23 @@ for more information. This task has been tested with jsch-0.1.2 and later.</p> | |||||
remote server. Default is 755. <em>since Ant 1.9.5</em>.</td> | remote server. Default is 755. <em>since Ant 1.9.5</em>.</td> | ||||
<td align="center" valign="top">No</td> | <td align="center" valign="top">No</td> | ||||
</tr> | </tr> | ||||
<tr> | |||||
<td valign="top">serverAliveIntervalSeconds</td> | |||||
<td valign="top">Sets a timeout interval in seconds after which if no data has | |||||
been received from the server, the task will send a message through | |||||
the encrypted channel to request a response from the server. | |||||
<em>since Ant 1.9.7</em></td> | |||||
<td align="center" valign="top">No, the default is 0, indicating | |||||
that these messages will not be sent to the server</td> | |||||
</tr> | |||||
<tr> | |||||
<td valign="top">serverAliveCountMax</td> | |||||
<td valign="top">The number of server alive messages which may be | |||||
sent without receiving any messages back from the server. Only | |||||
used if serverAliveIntervalSeconds is not 0. | |||||
<em>since Ant 1.9.7</em></td> | |||||
<td align="center" valign="top">No, defaults to 3</td> | |||||
</tr> | |||||
</table> | </table> | ||||
<h3>Parameters specified as nested elements</h3> | <h3>Parameters specified as nested elements</h3> | ||||
@@ -230,6 +230,23 @@ and won't work with versions of jsch earlier than | |||||
<em>since Ant 1.9.4</em></td> | <em>since Ant 1.9.4</em></td> | ||||
<td align="center" valign="top">No, defaults to false</td> | <td align="center" valign="top">No, defaults to false</td> | ||||
</tr> | </tr> | ||||
<tr> | |||||
<td valign="top">serverAliveIntervalSeconds</td> | |||||
<td valign="top">Sets a timeout interval in seconds after which if no data has | |||||
been received from the server, the task will send a message through | |||||
the encrypted channel to request a response from the server. | |||||
<em>since Ant 1.9.7</em></td> | |||||
<td align="center" valign="top">No, the default is 0, indicating | |||||
that these messages will not be sent to the server</td> | |||||
</tr> | |||||
<tr> | |||||
<td valign="top">serverAliveCountMax</td> | |||||
<td valign="top">The number of server alive messages which may be | |||||
sent without receiving any messages back from the server. Only | |||||
used if serverAliveIntervalSeconds is not 0. | |||||
<em>since Ant 1.9.7</em></td> | |||||
<td align="center" valign="top">No, defaults to 3</td> | |||||
</tr> | |||||
</table> | </table> | ||||
<h3>Examples</h3> | <h3>Examples</h3> | ||||
@@ -42,6 +42,8 @@ public abstract class SSHBase extends Task implements LogListener { | |||||
private boolean failOnError = true; | private boolean failOnError = true; | ||||
private boolean verbose; | private boolean verbose; | ||||
private final SSHUserInfo userInfo; | private final SSHUserInfo userInfo; | ||||
private int serverAliveCountMax = 3; | |||||
private int serverAliveIntervalSeconds = 0; | |||||
/** | /** | ||||
* Constructor for SSHBase. | * Constructor for SSHBase. | ||||
@@ -104,6 +106,46 @@ public abstract class SSHBase extends Task implements LogListener { | |||||
return verbose; | return verbose; | ||||
} | } | ||||
/** | |||||
* Set the serverAliveCountMax value. | |||||
* @since Ant 1.9.7 | |||||
*/ | |||||
public void setServerAliveCountMax(final int countMax) { | |||||
if (countMax <= 0) { | |||||
throw new BuildException("ssh server alive count max setting cannot be negative or zero"); | |||||
} | |||||
this.serverAliveCountMax = countMax; | |||||
} | |||||
/** | |||||
* Get the serverAliveCountMax value. | |||||
* @return the serverAliveCountMax value | |||||
* @since Ant 1.9.7 | |||||
*/ | |||||
public int getServerAliveCountMax() { | |||||
return serverAliveCountMax; | |||||
} | |||||
/** | |||||
* Set the serverAliveIntervalSeconds value in seconds. | |||||
* @since Ant 1.9.7 | |||||
*/ | |||||
public void setServerAliveIntervalSeconds(final int interval) { | |||||
if (interval < 0) { | |||||
throw new BuildException("ssh server alive interval setting cannot be negative"); | |||||
} | |||||
this.serverAliveIntervalSeconds = interval; | |||||
} | |||||
/** | |||||
* Get the serverAliveIntervalSeconds value in seconds. | |||||
* @return the serverAliveIntervalSeconds value in seconds | |||||
* @since Ant 1.9.7 | |||||
*/ | |||||
public int getServerAliveIntervalSeconds() { | |||||
return serverAliveIntervalSeconds; | |||||
} | |||||
/** | /** | ||||
* Username known to remote host. | * Username known to remote host. | ||||
* | * | ||||
@@ -221,6 +263,12 @@ public abstract class SSHBase extends Task implements LogListener { | |||||
session.setConfig("PreferredAuthentications", | session.setConfig("PreferredAuthentications", | ||||
"publickey,keyboard-interactive,password"); | "publickey,keyboard-interactive,password"); | ||||
session.setUserInfo(userInfo); | session.setUserInfo(userInfo); | ||||
if (getServerAliveIntervalSeconds() > 0) { | |||||
session.setServerAliveCountMax(getServerAliveCountMax()); | |||||
session.setServerAliveInterval(getServerAliveIntervalSeconds() * 1000); | |||||
} | |||||
log("Connecting to " + host + ":" + port); | log("Connecting to " + host + ":" + port); | ||||
session.connect(); | session.connect(); | ||||
return session; | return session; | ||||