mercurial/httppeer.py
branchstable
changeset 23086 cde6904f1992
parent 21188 d36440d84328
child 23895 cda18ded2c48
--- a/mercurial/httppeer.py	Fri Oct 24 14:24:28 2014 -0700
+++ b/mercurial/httppeer.py	Sat Oct 25 21:34:49 2014 -0400
@@ -214,6 +214,7 @@
 
     def _calltwowaystream(self, cmd, fp, **args):
         fh = None
+        fp_ = None
         filename = None
         try:
             # dump bundle to disk
@@ -225,10 +226,12 @@
                 d = fp.read(4096)
             fh.close()
             # start http push
-            fp = httpconnection.httpsendfile(self.ui, filename, "rb")
+            fp_ = httpconnection.httpsendfile(self.ui, filename, "rb")
             headers = {'Content-Type': 'application/mercurial-0.1'}
-            return self._callstream(cmd, data=fp, headers=headers, **args)
+            return self._callstream(cmd, data=fp_, headers=headers, **args)
         finally:
+            if fp_ is not None:
+                fp_.close()
             if fh is not None:
                 fh.close()
                 os.unlink(filename)