Closed mykola2312 closed 1 month ago
Done
I think the tests still use the old flag, that's why it is failing
Damn I forgot to update tests
Why this is hidden by command line flag? Shouldn't it be default behavior to not delete files when user was downloading, not actually deleting stuff?
This is done when receiving a file fails, so a client sending a file and if there's an error, a cleanup happens, since the file is not complete. This is actually the behaviour of most TFTP servers.
So, I was tinkering with some embedded device which had only busybox and TFTP client. That time I realized I need minimal but feature-able TFTP server, so I looked up and found your project. Everything was going OK until I stumbled upon troubles with dumping block devices. You see, when program reaches end of available block device, like /dev/mtdblock4, it will throw IO error instead of usual EOF, and when error happens the TFTP daemon deletes file. This is not what I wanted and I realized there is no way to disable file deletion. In the end of the day dump was OK and file deletion is unnecessary in this case.
In this PR I made
Config
/ClientConfig
parse--dont-clean
option, which then affects value ofclean_on_error
variable inConfig
/ClientConfig
structs. When instantiatingWorker
, there is new param which isclean_on_error
. I had to pass it intoWorker
struct, otherwise I would be stuck with global variable or something.I also changed tests and checked them to work with new parameter.
Best regards,