https://bz.apache.org/bugzilla/show_bug.cgi?id=63252

--- Comment #1 from Eugène Adell <[email protected]> ---
Created attachment 36481
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36481&action=edit
patch

This patch introduces a new attribute wakeUpTransferInterval indicating a time
in seconds, to be used with listings that take too much time and trigger a
Timeout.

When not set, or if the value is <= 0, the old behavior is kept.

As there is no way to know in advance if there is such Timeout on the server,
and which value is set, we only can discover the timeout value with a first
test without this attribute or assume the timeout is likely to be at 60s
minimum (probably the common practice among administrators).

The command used to trigger a data connection is a LIST on the current file
being parsed by the listing.

Tested succesfully with this target :

  <target name="listingWithSymlinks">
    <ftp action="list"
       listing="listingWithSymlinks.txt"
       server="ftp.ietf.org"
       port="21"
       wakeUpTransferInterval="53"
       remotedir="/rfc/bcp"
       userid="anonymous"
       password="anonymous" >
       <fileset dir="." defaultexcludes="no" includes="*" />
    </ftp>
  </target>

output : 

Buildfile: /home/eadell/tests/ftpant/rfc.xml
Adding reference: ant.PropertyHelper
Detected Java version: 1.8 in: /usr/local/java/jdk1.8.0_121/jre
Detected OS: Linux
Adding reference: ant.ComponentHelper
Setting ro project property: ant.file -> /home/eadell/tests/ftpant/rfc.xml
Setting ro project property: ant.file.type -> file
Setting ro project property: ant.project.invoked-targets -> listingWithSymlinks
Adding reference: ant.projectHelper
Adding reference: ant.parsing.context
Adding reference: ant.targets
parsing buildfile /home/eadell/tests/ftpant/rfc.xml with URI =
file:/home/eadell/tests/ftpant/rfc.xml
Setting ro project property: ant.project.name -> FTP test
Adding reference: FTP test
Setting ro project property: ant.project.default-target -> listing
Setting ro project property: ant.file.FTP test ->
/home/eadell/tests/ftpant/rfc.xml
Setting ro project property: ant.file.type.FTP test -> file
Project base dir set to: /home/eadell/tests/ftpant
 +Target:
 +Target: feat
 +Target: listingWithSymlinks
 +Target: listingWithoutSymlinks
 +Target: download
Adding reference: ant.LocalProperties
parsing buildfile
jar:file:/home/eadell/base_ant/apache-ant-1.10.5.compiled/dist/lib/ant.jar!/org/apache/tools/ant/antlib.xml
with URI = ja                                                         
r:file:/home/eadell/base_ant/apache-ant-1.10.5.compiled/dist/lib/ant.jar!/org/apache/tools/ant/antlib.xml
from a zip file
Setting project property: lib -> /home/eadell/tests/ftpant/lib
Adding reference: lib
Setting ro project property: ant.project.invoked-targets -> listingWithSymlinks
Attempting to create object of type org.apache.tools.ant.helper.DefaultExecutor
Adding reference: ant.executor
Build sequence for target(s) `listingWithSymlinks' is [listingWithSymlinks]
Complete build sequence is [listingWithSymlinks, download,
listingWithoutSymlinks, feat, ]

listingWithSymlinks:
      [ftp] Opening FTP connection to ftp.ietf.org
      [ftp] connected
      [ftp] logging in to FTP server
      [ftp] login succeeded
      [ftp] changing the remote directory to /rfc/bcp
      [ftp] listing files
fileset: Setup scanner in dir /home/eadell/tests/ftpant with patternSet{
includes: [*] excludes: [] }
wakeUpTransferInterval is reached, trigger a data connection
wakeUpTransferInterval is reached, trigger a data connection
      [ftp] 221 files listed
      [ftp] disconnecting

BUILD SUCCESSFUL
Total time: 5 minutes 4 seconds

real    5m5.130s
user    0m5.852s
sys     0m1.016s


This patch doesn't prevent other timeouts (such as 421 Session Timeout) that
come much later with some servers, that should be adressed in another way.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to