summaryrefslogtreecommitdiffstats
path: root/src/main.c
Commit message (Collapse)AuthorAgeFilesLines
* delete created file when fallocate failsJose M. Guisado2022-09-291-0/+12
|
* keep client retries when tip_client_request_file failsJose M. Guisado2022-09-281-2/+2
| | | | | | | | 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.
* replace posix_fallocate with fallocateJose M. Guisado2022-09-271-1/+2
| | | | | | | | | | 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.
* fix received data incorrect arithmeticstiptorrent development team2022-02-121-1/+1
| | | | | subtract HTTP header otherwise connection is closed before all data is received.
* validate received bytes and expected file sizetiptorrent development team2022-02-121-0/+6
|
* increase number of chunks to 64tiptorrent development team2022-02-101-1/+1
|
* do not reset number of retries countertiptorrent development team2022-02-081-0/+3
|
* clean up state on each retrytiptorrent development team2022-02-081-9/+12
| | | | Reset the client object after retrying connection to download file.
* update statistics after successful downloadtiptorrent development team2022-02-081-5/+5
|
* fall back to server after reaching maximum number of retriestiptorrent development team2022-02-081-1/+18
| | | | | | | | Use the HTTP header field: X-Accept-Redirect: off to ask for a direct download from the server.
* bail out after maximum number of retriestiptorrent development team2022-02-081-3/+17
| | | | | stop downloading remaining chunks if one is missing after the maximum number of retries.
* missing close() on file on exit pathtiptorrent development team2021-12-231-0/+1
|
* use fallocate() to store the chunks in the filetiptorrent development team2021-12-231-15/+89
| | | | | | | 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().
* add helper function to connect and send HTTP requesttiptorrent development team2021-12-231-23/+33
|
* fix download of very small filestiptorrent development team2021-12-231-3/+0
| | | | | 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.
* rename POST redirect handlertiptorrent development team2021-12-231-2/+2
|
* rename HTTP GET handlerstiptorrent development team2021-12-231-4/+4
|
* rename TIP_CLIENT_NOTIFY_REDIRECT to TIP_CLIENT_POST_REDIRECTtiptorrent development team2021-12-231-4/+4
|
* rename TIP_CLIENT_RECEIVING_* states to TIP_CLIENT_GET_*tiptorrent development team2021-12-231-7/+7
|
* add retry logictiptorrent development team2021-10-021-2/+13
| | | | | | - 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.
* display progress message every 30 secondstiptorrent development team2021-09-291-1/+4
| | | | to avoid bloating the logs
* print progress messagetiptorrent development team2021-09-291-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* fix connection closed by servertiptorrent development team2021-09-261-1/+1
|
* floating exception if download is too fasttiptorrent development team2021-09-231-2/+2
| | | | fix divide by zero if file download takes less than 1 second.
* revisit error reportingtiptorrent development team2021-09-201-7/+33
|
* display failure stats on syslogtiptorrent development team2021-09-191-2/+9
|
* print stats to syslogtiptorrent development team2021-09-191-1/+2
|
* incorrect mbytes/second statstiptorrent development team2021-09-181-1/+3
| | | | accumulate data from all file
* report socket is connected, instead of connectingtiptorrent development team2021-09-181-2/+2
|
* incorrect loop break logic on errortiptorrent development team2021-09-181-1/+1
|
* fix connect error pathtiptorrent development team2021-09-181-6/+5
| | | | Use syslog() and do not check for EINPROGRESS on the second connect() call.
* display download rate in Mbytes/secondstiptorrent development team2021-09-181-1/+2
|
* enable TCP keepalivedtiptorrent development team2021-09-181-0/+12
|
* initial committiptorrent development team2021-09-181-0/+440