Jose M. Guisado
edb59d4907
avoid useless retries when a fatal error occurs
...
Adds "fatal" bool field to struct tip_client.
Fatal is looked for when cli->error is set, if fatal is set then no
retry is done and tiptorrent-client should terminate.
2022-09-29 17:03:23 +02:00
Jose M. Guisado
ec5b9dc003
delete created file when fallocate fails
2022-09-29 17:03:23 +02:00
Jose M. Guisado
db4f4980c5
keep client retries when tip_client_request_file fails
...
Keep client retry count when something goes wrong requesting
file size (HEAD request).
Fixes a bug where tiptorrent-client keeps sending HEAD requests
indifinitely when something goes wrong at this stage.
2022-09-28 16:09:32 +02:00
Jose M. Guisado
67d9fde94c
replace posix_fallocate with fallocate
...
posix_fallocate does not return -1 for an error case.
Replace posix_fallocate for fallocate which does return -1 when
something goes wrong. See fallocate(2):
On success, fallocate() returns zero.
On error, -1 is returned and errno is set to indicate the error.
2022-09-27 17:56:19 +02:00
Jose M. Guisado
9bfb511749
tests: add optional parameter for clients number
...
Test can be run with an optional number, this number indicates how many
client processes to run. Eg: ./run-tests.sh 50
Defaults to 18 clients when no parameter is supplied.
Also, wait for shell jobs to finish before exit.
2022-02-14 10:06:15 +01:00
tiptorrent development team
86beaee6e6
fix received data incorrect arithmetics
...
subtract HTTP header otherwise connection is closed before all data is
received.
2022-02-12 12:58:44 +01:00
tiptorrent development team
cc67335f13
validate received bytes and expected file size
2022-02-12 12:40:33 +01:00
tiptorrent development team
db94ee6ef8
increase number of chunks to 64
2022-02-10 23:21:45 +01:00
tiptorrent development team
900ae1d783
do not reset number of retries counter
2022-02-08 17:27:32 +01:00
tiptorrent development team
ace36ad510
clean up state on each retry
...
Reset the client object after retrying connection to download file.
2022-02-08 16:24:15 +01:00
tiptorrent development team
93c13ba67c
update statistics after successful download
2022-02-08 16:04:50 +01:00
tiptorrent development team
a989987319
fall back to server after reaching maximum number of retries
...
Use the HTTP header field:
X-Accept-Redirect: off
to ask for a direct download from the server.
2022-02-08 13:18:19 +01:00
tiptorrent development team
39e60a019a
bail out after maximum number of retries
...
stop downloading remaining chunks if one is missing after the maximum number of
retries.
2022-02-08 12:21:05 +01:00
tiptorrent development team
e9de4e482f
missing close() on file on exit path
2021-12-23 21:03:02 +01:00
tiptorrent development team
35f3191e4c
use fallocate() to store the chunks in the file
...
The client sends a HTTP HEAD request to the server to check that the file exists
and to get the file size, then it calls open() to create the file and
fallocate() to preallocate the bytes. The client calculates the offset based on
the chunk number and it calls lseek().
2021-12-23 19:11:37 +01:00
tiptorrent development team
4e2ba97629
add helper function to connect and send HTTP request
2021-12-23 18:29:24 +01:00
tiptorrent development team
e15e2364f7
fix download of very small files
...
If the first recv() call fully gets the HTTP header and the file chunk, then
tip_client_get_hdr() returns 1 to enter the TIP_CLIENT_DONE state to finish.
2021-12-23 18:27:37 +01:00
tiptorrent development team
6e55df90e4
rename POST redirect handler
2021-12-23 18:21:32 +01:00
tiptorrent development team
be1a7b9563
rename HTTP GET handlers
2021-12-23 18:20:50 +01:00
tiptorrent development team
be1b23b5f9
rename TIP_CLIENT_NOTIFY_REDIRECT to TIP_CLIENT_POST_REDIRECT
2021-12-23 18:20:37 +01:00
tiptorrent development team
85ff3e5d57
rename TIP_CLIENT_RECEIVING_* states to TIP_CLIENT_GET_*
2021-12-23 18:20:32 +01:00
tiptorrent development team
486e1b8351
add retry logic
...
- if the connection to server fails, retry 5 times, sleeping 5 seconds before
each retry.
- if the redirection fails, go back and request the chunk from the server again.
2021-10-02 11:46:22 +02:00
tiptorrent development team
48da60d883
display progress message every 30 seconds
...
to avoid bloating the logs
2021-09-29 17:46:47 +02:00
tiptorrent development team
73d546b23a
print progress message
...
Print a progress message to stdout:
0% (0 Mbytes/second) file.img.2 from 192.168.2.179:9999
29% (113 Mbytes/second) file.img.2 from 192.168.2.179:9999
59% (113 Mbytes/second) file.img.2 from 192.168.2.179:9999
88% (114 Mbytes/second) file.img.2 from 192.168.2.179:9999
100% (128 Mbytes/second) file.img.2 from 192.168.2.179:9999
0% (0 Mbytes/second) file.img.3 from 192.168.2.179:9999
29% (113 Mbytes/second) file.img.3 from 192.168.2.179:9999
58% (113 Mbytes/second) file.img.3 from 192.168.2.179:9999
88% (113 Mbytes/second) file.img.3 from 192.168.2.179:9999
100% (128 Mbytes/second) file.img.3 from 192.168.2.179:9999
0% (0 Mbytes/second) file.img.1 from 192.168.2.179:9999
29% (114 Mbytes/second) file.img.1 from 192.168.2.179:9999
59% (114 Mbytes/second) file.img.1 from 192.168.2.179:9999
88% (113 Mbytes/second) file.img.1 from 192.168.2.179:9999
100% (128 Mbytes/second) file.img.1 from 192.168.2.179:9999
0% (0 Mbytes/second) file.img.0 from 192.168.2.179:9999
29% (113 Mbytes/second) file.img.0 from 192.168.2.179:9999
59% (113 Mbytes/second) file.img.0 from 192.168.2.179:9999
88% (113 Mbytes/second) file.img.0 from 192.168.2.179:9999
100% (128 Mbytes/second) file.img.0 from 192.168.2.179:9999
OK.
2021-09-29 16:46:05 +02:00
tiptorrent development team
7e02f8e7c6
tiptorrent-client is released under AGPL3+
2021-09-29 15:54:00 +02:00
tiptorrent development team
46f1e923db
fix connection closed by server
2021-09-26 16:52:30 +02:00
tiptorrent development team
3adc9338d1
floating exception if download is too fast
...
fix divide by zero if file download takes less than 1 second.
2021-09-23 22:45:04 +02:00
tiptorrent development team
cc0caf9474
no need for root to run tiptorrent-client
2021-09-22 15:50:46 +02:00
tiptorrent development team
84cc926c8e
revisit error reporting
2021-09-20 12:05:15 +02:00
tiptorrent development team
97f7ab42ab
display failure stats on syslog
2021-09-19 21:56:13 +02:00
tiptorrent development team
c8495d5a89
print stats to syslog
2021-09-19 00:07:04 +02:00
tiptorrent development team
8cf20e6639
incorrect mbytes/second stats
...
accumulate data from all file
2021-09-18 23:41:14 +02:00
tiptorrent development team
5ad75d7db0
report socket is connected, instead of connecting
2021-09-18 23:26:01 +02:00
tiptorrent development team
6b47735b55
incorrect loop break logic on error
2021-09-18 23:26:01 +02:00
tiptorrent development team
388a3c1f45
fix connect error path
...
Use syslog() and do not check for EINPROGRESS on the second connect() call.
2021-09-18 22:16:29 +02:00
tiptorrent development team
24f629178d
display download rate in Mbytes/seconds
2021-09-18 21:54:56 +02:00
tiptorrent development team
e365ceb024
enable TCP keepalived
2021-09-18 21:25:30 +02:00
tiptorrent development team
5c8ec91711
initial commit
2021-09-18 18:36:06 +02:00