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:
parent
7f17176e2b
commit
0974b10241
1 changed files with 6 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue