axel-download-accelerator / axel

Lightweight CLI download accelerator
GNU General Public License v2.0
2.84k stars 258 forks source link

timeout does not take effect #421

Open Dreamcoke opened 4 months ago

Dreamcoke commented 4 months ago

Hi,I use the timeout parameter to download a file in a single thread and set the timeout to 1s. The file download takes 6s. It seems that the timeout does not take effect. The file will continue to download without interruption. What is the meaning of the timeout parameter? The following is the axel version and test cases axel -V Axel 2.17.11 (darwin22.1.0)

time axel -n 1 --timeout=1 http://nos2-i.service.163.org/nim/MjYyNDYzMzg\=/bmltYV8xOTc1MDEyMjQzMzVfMTcwMjAzNTg5MTY4MF9mODkyNWYzNC1mODk5LTRlZDUtODY2MC1hNzk1NGZkNmU5NDU\= Initializing download: http://nos2-i.service.163.org/nim/MjYyNDYzMzg=/bmltYV8xOTc1MDEyMjQzMzVfMTcwMjAzNTg5MTY4MF9mODkyNWYzNC1mODk5LTRlZDUtODY2MC1hNzk1NGZkNmU5NDU= File size: 11.4211 Megabyte(s) (11975921 bytes) Opening output file MjYyNDYzMzg_3D_2FbmltYV8xOTc1MDEyMjQzMzVfMTcwMjAzNTg5MTY4MF9mODkyNWYzNC1mODk5LTRlZDUtODY2MC1hNzk1NGZkNmU5NDU_3D.12 Starting download

[100%] [................................................................................................................................................................................................................................................] [ 1.8MB/s] [00:00]

Downloaded 11.4211 Megabyte(s) in 6 second(s). (1875.52 KB/s) axel -n 1 --timeout=1 0.07s user 0.17s system 3% cpu 6.667 total

colemar commented 4 months ago

I believe the timeout is for stopping axel as soon as the allotted time passes without response from the remote host. If the remote server sends some data before the timeout expires, axel resets the timer and continues. Does this make sense?

colemar commented 4 months ago

Well it seems that the timeout does not matter when the remote host does not accept the connection. In this situation, axel blocks waiting forever.

I mean, when this happens:

$ ncat -v str-28.filestore.app 443
Ncat: Version 7.80 ( https://nmap.org/ncat )
Ncat: Connection to 88.208.57.132 failed: TIMEOUT.

then this does not stop:

axel --num-connections=1 --timeout=2 https://str-28.filestore.app/

Then, what is timeout for?

ismaell commented 3 months ago

It isn't implemented for the connection attempt, currently. Patches welcome.