Plugin XEP-0065: dest_file is now propertly closed after copy, and data dict in getProgress is not filled in case of file access error (file closed)

This commit is contained in:
Goffi 2010-08-16 21:08:19 +08:00
commit 0974b10241

View file

@ -354,15 +354,19 @@ class SOCKSv5(protocol.Protocol, FileSender):
def getProgress(self, data):
"""Fill data with position of current transfert"""
data["size"] = self.filesize
try:
data["position"] = str(self.dest_file.tell())
data["size"] = self.filesize
except (ValueError, AttributeError):
data["position"] = ""
pass
def fileTransfered(self, d):
info(_("File transfer completed, closing connection"))
self.transport.loseConnection()
try:
self.dest_file.close()
except:
pass
def updateTransfered(self, data):
self.transfered+=len(data)