[Twisted-Python] dcc, idea for file resume

Glyph Lefkowitz glyph at twistedmatrix.com
Mon Oct 12 18:51:49 MDT 2015


> On Oct 12, 2015, at 11:01 AM, peter <commercials24 at yahoo.de> wrote:
> 
> hi,
> 
> 
> the way file resume is implemented in DccFileReceive requires to user to determine the file size manually and set _resumeOffset.
> wouldnt it make sene to just kill the last few bytes of the file and resume it?
> 
> below is the current connectionMade method from:
> http://twistedmatrix.com/trac/browser/tags/releases/twisted-15.4.0/twisted/words/protocols/irc.py#L3013 <http://twistedmatrix.com/trac/browser/tags/releases/twisted-15.4.0/twisted/words/protocols/irc.py#L3013>
> 
> 
> replace this line:
> self.file.seek(self._resumeOffset)
> 
> with:
> self.file.seek(-3,2)
> 
> 
> which removes the last 3 bytes from the file end, 3 is just a guess.

Why remove the last 3 bytes?  It seems like either the file's contents are valid or not; if they are, just trust everything that's there, if not, don't try to resume...

Generally though this does sound like a good change!  Don't make the user guess if we can just do the right thing for them.  Can you open a ticket?

-glyph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20151012/2eb29530/attachment-0002.html>


More information about the Twisted-Python mailing list