fclairamb / ftpserverlib

golang ftp server library
MIT License
415 stars 97 forks source link

IdleTimeout doesn't factor in active data connection (large or slow transfers) #430

Open dkandarp opened 7 months ago

dkandarp commented 7 months ago

When control connection is idle for more than IdleTimeout duration, server immediately closes control connection and ignores on going data transfer through data connection. https://github.com/fclairamb/ftpserverlib/blob/main/client_handler.go#L413

This is not correct behavior. Transfer rate and time can very depending on network and file size. Before terminating control connection, server should check if there is any active data connection.

drakkan commented 7 months ago

Hello,

this is a known issue. I think most users handle idle connections outside of the library (and I'm not sure if their management needs to be done inside the library), however since this is an advertised feature, we can review a PR if you'd like to send some one. Thank you

dkandarp commented 6 months ago

Hello,

this is a known issue. I think most users handle idle connections outside of the library (and I'm not sure if their management needs to be done inside the library), however since this is an advertised feature, we can review a PR if you'd like to send some one. Thank you

Does it mean specify idle timeout with large arbitrary value to avoid deadline, and manage connection through Driver?
Since connection is initiated inside library, I think its lifecycle should be encapsulated within library.

Happy to work on PR, will submit shortly.