From: david-sarah <david-sarah@jacaranda.org>
Date: Tue, 1 Jun 2010 05:53:10 +0000 (-0700)
Subject: SFTP: fix a bug that caused the temporary files underlying EncryptedTemporaryFiles... 
X-Git-Url: https://git.rkrishnan.org/pf/content/%22news.html/copyable.html?a=commitdiff_plain;h=db394671e91e3ca78d6f0364b6ab2197bd35e1eb;p=tahoe-lafs%2Ftahoe-lafs.git

SFTP: fix a bug that caused the temporary files underlying EncryptedTemporaryFiles not to be closed.
---

diff --git a/src/allmydata/frontends/sftpd.py b/src/allmydata/frontends/sftpd.py
index 3ba07146..a624dddc 100644
--- a/src/allmydata/frontends/sftpd.py
+++ b/src/allmydata/frontends/sftpd.py
@@ -557,13 +557,13 @@ class OverwriteableFileConsumer(PrefixingLogMixin):
         #self.unregisterProducer()
 
     def close(self):
-        self.is_closed = True
-        self.finish()
         if not self.is_closed:
+            self.is_closed = True
             try:
                 self.f.close()
             except BaseException as e:
                 self.log("suppressed %r from close of temporary file %r" % (e, self.f), level=WEIRD)
+        self.finish()
 
     def unregisterProducer(self):
         if self.producer: