FTP server: upload should support async close
|Reported by:||warner||Owned by:|
|Cc:||exarkun, terrycojones, spiv||Branch:||
branch-diff, diff-cov, branch-cov, buildbot
As discussed on the mailing list, the FTP server in current trunk (r24958) does not have a mechanism for handling uploads that are not complete the moment the last byte is accepted by the consumer. This makes it difficult, for example, to implement an FTP frontend on a virtual filesystem that takes some amount of time/work to finish the upload process.
The proposed solution is to enhance [source:trunk/twisted/protocols/ftp.py#L1424 ftp:IWriteFile] to add a close() method, which will be called after the consumer has been disconnected, but before the '226 Transfer Complete' response is sent. close() can return a Deferred, and the response will not be sent until after it fires. The value produced by this Deferred is ignored.
Other proposed solutions were:
- modify unregisterProducer to allow it to return a Deferred
- do something at the VFS level
A patch to implement this change is attached. It does not yet have specific test coverage, but of course the existing tests still pass.
Change History (14)
Changed 8 years ago by warner
Changed 6 years ago by warner
comment:2 Changed 6 years ago by warner
- Cc terrycojones added
- Keywords review added
- Priority changed from normal to highest